WordPress.org

Ready to get started?Download WordPress

Forums

Set Custom Post Title Programmatically (2 posts)

  1. antoinicolas
    Member
    Posted 1 year ago #

    I would like a tiny plugin to set programmatically the title of posts from a Custom Post Type.
    Title for this Custom Post Type is hidden to Editor, so I want the system to set the title automatically for consistency, using a unique timecode.
    Could you please help me ?

  2. Kakoma
    Member
    Posted 1 year ago #

    This is long overdue but just in case someone needs it, it is best to use the 'enter_title_here' filter and modify the title to hold something relevant to your custom post type

    add_filter('enter_title_here','themeSlug_alter_title_label',10,2);
    
    function themeSlug_alter_title_label($label, $post){
            if( 'book' == get_post_type($post) )
                $label = __('Enter book title here', 'guntu');
    
            return $label;
        }

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.