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:
- How to enqueue scripts on custom post add/edit pages?
- Change “Enter Title Here” help text on a custom post type
- 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
- 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
- Why get_next_post_link() or get_previous_post_link() doesn’t return the required links?
- Admin Post Update Redirection to Posts Screen
- 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?
- 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
- remove_action conditionally for Custom Post Type
- Using a Custom Field instead of original title field but only for Custom Post Type
- 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
- 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
- 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
- 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
- Validate custom fields before save using WordPress Rest API
- Add acf field in title (admin table)
- 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 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
- 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?
- 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
- How do I amend form data before it is saved for a custom post type
- Add an Outside Wrapper to my Header and Make it Full Width
- Address as a content type post
- How check if a post is saved from backend or frontend?
- WordPress hook which triggers on post import
- providing access to post_id or post inside functions.php
- Before saving post hook
- Sanitize title only if only custom post type
- Creating alternate meta box context locations
- comments hooks on custom post type
- Add the custom post term to the custom post title
- Catch and display error on save_post action
- How to recover the post ID earlier in the WP admin hook action “firing” sequence?
- Auto Generate Post Title from 2 Custom Fields
- Limiting actions only to edit.php page for specific custom post type
- Using `set_transient()` when saving a custom post type
- Using publish_{custom-post-type} hook for custom post type to update meta doesn’t work
- Title and URL Error in Breadcrumb Navigation for Custom Post Types
- Add html tot CPT edit screen – no metabox
- Plugin Development using classes – Public & Private Callbacks
- In child theme, add CPT to custom taxonomy registered in parent theme
- Store a value in global scope after init hook is fired
- Changing CPT permalink
- Dynamic page for nav items used as filters
- Want to add new label in new post
- Hook create / update post
- Sort custom post archives by a meta value from a different custom post type?
- Correct way to register custom post type from external php file?
- How to store additional data that is related to core data
- filter the title changed also the page titles
- call a function when insert and update a custom post type
- Error [Column ‘post_title’ cannot be null] when title is disabled for Custom post type
- 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
- Register a title automatically with a relationship field
- add comments custom fields after user is logged in
- Change CPT Edit Target Link for Admin List