I use a code which differs from yours a little bit. There is no need to get the current screen using the enter_title_here
-filter because you have already a post-object:
/**
* Filter: Modifies the standard placeholder text
* @param string $title
* @param WP_Post $post
* @return string
*/
function my_enter_title_here( $title, $post ) {
if ( 'POST_TYPE' == $post->post_type ) {
$title="Custom placeholder text here";
}
return $title;
}
add_filter( 'enter_title_here', 'my_enter_title_here', 10, 2 );
Related Posts:
- Hook for post and page load
- How to enqueue scripts on custom post add/edit pages?
- Change “Enter Title Here” help text on a custom post type
- How do you use a CPT as the default home page?
- Calling a Function After New Post Creation for a WordPress Custom Post Type?
- How do I get a post (page or CPT) ID from a title or slug?
- Limit the word count in the post title
- Is there a way to override the tag specified in header.php?
- How to Debug the ‘save_post’ Action?
- Adding a drag and drop re-ordering from a custom post type default list [closed]
- get_query_var() not working in pre_get_posts
- Unregister post type from child theme
- Filter for “get_post_type_archive_link()”
- How to correctly get post type in a the_title filter
- How to add a button to custom post type’s posts-page
- title_save_pre on post publish
- flush_rewrite_rules on save_post Does Not Work on First Post Save
- Set Custom Post Type title to the Post’s Date
- Change title in head on Archive page
- How To Set Custom Post Type Title Without Supports
- Custom Taxonomies Terms as Post Title for Custom Post Types upon Publishing
- Why get_next_post_link() or get_previous_post_link() doesn’t return the required links?
- Admin Post Update Redirection to Posts Screen
- How often do you need to register_post_type?
- Set post title from two meta fields
- How to create notification on frontend using heartbeat api for multiple custom post types
- How to set a custom post type post as static front page?
- With what hook can I address all posts from all custom post types when they are published?
- How I check if the same post slug has not been used before publishing?
- specify meta_key / meta_value condition for prev_post_link and next_post_link
- Custom Post Type with Custom Title
- Setting a title on a Custom Post Type that doesn’t support titles
- Hook when adding or editing a specific custom post type? [closed]
- remove_action conditionally for Custom Post Type
- Using a Custom Field instead of original title field but only for Custom Post Type
- Search Post Title Only [duplicate]
- dynamically update permalink and title with the values of custom fileds
- get_page_by_title() not returning anything [closed]
- What hook should be used to programmatically create a post only when master post is updated?
- Creating a function that receives the taxonomy terms that have been changed in a custom post type
- How to register custom post types in a plugin?
- Add information above a custom post type listing of all posts page
- Custom Post Types: Custom columns with Title submenu?
- Remove “Get Shortlink” button in admin of custom post type
- Posts created in a Custom Post Type are lost if published without a title
- What is the impact if i ignore title and content in my custom post types CPT?
- How to filter out post type meta?
- Updating post title using wp_update_post
- Custom Blog Post Listing in Genesis Sample Child Theme
- Set a default category – if the user didn’t select one- before creating a post
- Can’t unregister parent theme’s CPT from my child theme
- Modifying date filter on admin page for custom post type to link to custom field
- Using several custom fields as custom post title
- How to retrieve category NAME instead of ID in a function with a taxonomy custom field?
- How to use the Display Name as the post title in a custom post type?
- Hooking in to an archive page?
- Add custom column in custom post type edit page
- Insert Multiple Post with Same Publish Button
- Why is conditionally loading a custom plugin’s code only on a specific custom post type causing the site content to disappear?
- Validate custom fields before save using WordPress Rest API
- How to: Display ACF [fields] on Custom Post Types Utilising WordPress ‘Hooks’? [closed]
- Add acf field in title (admin table)
- Posts are duplicating on wp_post_update
- How can I run this code once so that my generated post title doesn’t keep changing on publish/update?
- Set a maxlength for the title input in a custom post type
- Limit number of custom posts per taxonomy
- Custom title set on quick edit
- Filter Posts from the Main Query
- Custom Postype specific changes in admin panel
- Custom Meta Title for Custom Post Type
- How to set the seo title tag on a page by page basis?
- Add the post type to the title of the page
- Categorise Custom Post Types
- How can I add a filter to a particular post format?
- Is there any way to get list of all possible filter hooks for all post types?
- Add a custom text to admin footer in a Custom Post Type page
- Get rid of “trash can” for custom post type
- Use remove_meta_box conditionally on custom post type
- Custom meta Title for custom post type archive from page
- Custom Meta fields Update hook?
- wp_trash_post action hook with custom post type
- Execute code only after user clicks ‘update’ button for CPT being edited
- Custom Fields as Post Type Options
- Adding Information To All Posts Screen
- do action inside a class is not working
- Filter Content on all Post Types
- Customizing a plugin function using a hook
- Set the Title of a Custom Post Type by code as Author’s Username
- Hook only specific post type
- Register a title automatically with a relationship field
- Create action running on trashed_post hook to modify post_meta value
- add comments custom fields after user is logged in
- How to string lines from the_content() hook in WordPress?
- Custom post type split title, setup permalink accordingly
- Redirect drafted post of custom post type to URL?
- Modifying post_type_link hook messing up edit function for a custom post
- Change CPT Edit Target Link for Admin List
- Custom post type template not loading from plugin
- How to display custom taxonomy subpage inside wp menu from a custom post type using add_menu_page() and add_submenu_page?
- Add a post when another post type is inserting