We Will discuss how to replace “Product name” placeholder text of title field on add product screen in Woocommerce and other post types of WordPress. So first of all Open your WordPress admin panel. Go to Products and Add new product and in title area you will see this text “Product name”. You will need to replace it with your custom text.
To do this add the following line of code at the end of your theme’s functions.php file of your active child theme (or theme). Save the file and refresh the page. You wil see New placeholder will be displayed.
This code is not specific to Woocommerce. It can be used to change other post types of wordpress as well like posts and pages. You just need to add additional conditional statements based on the post type just like We did for products.
In this line if ( ‘product’ == $screen->post_type ) you need to replace ‘product’ with the type of your post. Correct post type you can see when you add new post in browser url.
function change_product_placeholder( $title ){ $screen = get_current_screen(); if ( 'product' == $screen->post_type ) { $title = 'Enter Your Product Name'; } return $title; } add_filter( 'enter_title_here', 'change_product_placeholder' );