Site logo

[Support request] Hide title on custom post type

Home Forums Support [Support request] Hide title on custom post type

Home Forums Support Hide title on custom post type

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #2473543
    Laurentiu

    I’m trying to hide the title of a custom post type and it is not working. I used the code below, found on this forum:

    add_action( 'wp', 'tu_disable_cpt_elements' );
    function tu_disable_cpt_elements() { 
      if ( 'airfields' === get_post_type() && is_singular() ) {
        add_filter( 'generate_show_title', '__return_false' );
      }
    }

    The if is being executed, I added a text after it and it was displayed, but the filter doesn’t seem to be working.

    #2474041
    Leo
    Staff
    Customer Support

    Hi there,

    Can you try using creating a Layout Element to disable the content title first?
    https://docs.generatepress.com/article/layout-element-overview/#disable-element

    The CPT should show in the Display Rules:
    https://docs.generatepress.com/article/layout-element-overview/#display-rules

    #2474119
    Laurentiu

    I did it, but the title is still displayed. I tested deactivating other things, like the header, and it works for other elements but not the title.

    #2474121
    Laurentiu

    What is strange is that I disable the title from the edit page, and it still shows up.

    #2474148
    Leo
    Staff
    Customer Support

    Can you link us to the page in question?

    #2474358
    Laurentiu

    Sure, here it is.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.