Woocommerce: How to replace “Product name” placeholder text?

In this tutorial; We will learn how to change placeholder of title field on add product screen in Woocommerce and other post types of WordPress. Following is the default placeholder being displayed while creating a new product.

2015-09-28_1038

Now, We need to change this placeholder text. To do this adds the following lines of code at the end of your theme’s functions.php file:

function change_post_placeholder( $title ){
     $screen = get_current_screen();
 
     if  ( 'product' == $screen->post_type ) {
          $title = 'Enter Product Name';
     }
 
     return $title;
}
 
add_filter( 'enter_title_here', 'change_post_placeholder' );

after adding the code, Refresh the Page and New placeholder will be displayed.

2015-09-28_1041

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.

Waqas

I hope you enjoy reading this blog post. If you want my team to do WooCommerce Maintenance for you, click here.

Leave a Comment

Your email address will not be published. Required fields are marked *