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.
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.
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.