Support » Plugin: The SEO Framework – Fast, Automated, Effortless. » Breadcrumbs for custom post types

  • Hi Sybre,

    first of all thank you for the great plugin!

    I am trying to add breadcrumbs to a custom post type which I registered with CPT UI. Its working fine for posts and pages but breadcrumbs dont work for the CPT. I am using the Schema.org validator to check if breadcrumbs are available.

    I searched the documentation and the forum but could only find this summary: https://kb.theseoframework.com/kb/structured-data-supported-by-the-seo-framework/

    I tried to change the settings of the CPT, making is hierachical, adding of removing the archive. But breadcrumbs are never available.

    So does „Affected pages: All singular post types are supported. Support for archives is being worked on.“ that breadcrumbs won‘t work for CPTs?

    Thank you very much in advance. I thank I am missing something essential right now.

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Sybre Waaijer

    (@cybr)

    Hello!

    Could you please share with me a page where the breadcrumbs script is missing? With it, I can try to replicate the issue. Thanks!

    Thread Starter ja4st3r

    (@ja4st3r)

    Hi Sybre,
    its just a staging site, which I dont want to share publicly. Could I sent you the link via email or some other private way?

    • This reply was modified 3 months, 1 week ago by ja4st3r.
    Plugin Author Sybre Waaijer

    (@cybr)

    Hi again!

    You can send me a link here: https://tsf.fyi/contact.

    Plugin Author Sybre Waaijer

    (@cybr)

    Thanks for your email!

    TSF doesn’t support breadcrumb output for Archives, neither for Custom Post Types nor builtin post types (post/page).

    Breadcrumbs are supported for Singular posts for any post type. I plan to expand its support for Archives in TSF v4.3.0 — although… search engines often don’t return archives on the search engine results page (SERP); it’s quite a useless feature that I’ve been pushing back for years now.

    Thread Starter ja4st3r

    (@ja4st3r)

    Thank you very much for your response!

    I somehow missed that archives are no supported. Sorry for that. I am working on a directory website, and for that breadcrumbs would be helpful, but I totally understand that it is a niche case.

    For the singular posts in that post type I sent you, I am also not getting breadcrumbs. It is working for default posts and pages but not for the CPT. Is there any other limitation I have missed?

    Plugin Author Sybre Waaijer

    (@cybr)

    Hi again!

    I can see that. I believe the post type’s taxonomy is registered or cached incorrectly.

    Please see if clearing your site’s caches resolves the issue. Also, try flushing your permalinks (by resaving them).

    If that doesn’t help resolve the issue, please share the code that creates the post type and its taxonomies.

    Thread Starter ja4st3r

    (@ja4st3r)

    Hi Sybre,

    I finally found time to look at the issue again. I flushed the permalinks and the cleared the site cache. But with no effect.

    Please note that the custom post type doesnt have any taxonomies added. The default taxonomies are not activated.

    I am using CPT UI to register the custom post type. Here is the code:

    
    function cptui_register_my_cpts_master() {
    
    	/**
    	 * Post Type: Master.
    	 */
    
    	$labels = [
    		"name" => __( "Master", "generatepress" ),
    		"singular_name" => __( "Master", "generatepress" ),
    	];
    
    	$args = [
    		"label" => __( "Master", "generatepress" ),
    		"labels" => $labels,
    		"description" => "Custom Post Type in dem [...]. ",
    		"public" => true,
    		"publicly_queryable" => true,
    		"show_ui" => true,
    		"show_in_rest" => true,
    		"rest_base" => "",
    		"rest_controller_class" => "WP_REST_Posts_Controller",
    		"has_archive" => true,
    		"show_in_menu" => true,
    		"show_in_nav_menus" => true,
    		"delete_with_user" => false,
    		"exclude_from_search" => false,
    		"capability_type" => "post",
    		"map_meta_cap" => true,
    		"hierarchical" => false,
    		"can_export" => false,
    		"rewrite" => [ "slug" => "master", "with_front" => true ],
    		"query_var" => true,
    		"menu_icon" => "dashicons-welcome-learn-more",
    		"supports" => [ "title", "editor", "thumbnail", "excerpt", "trackbacks", "custom-fields", "comments", "revisions", "author", "page-attributes", "post-formats" ],
    		"taxonomies" => [ "category", "post_tag" ],
    		"show_in_graphql" => false,
    	];
    
    	register_post_type( "master", $args );
    }
    
    add_action( 'init', 'cptui_register_my_cpts_master' );
    

    To rule out that CPT UI is causing the issue I registered a basic CPT in PHP:

    
    function create_posttype() {
      
        register_post_type( 'movies',
        // CPT Options
            array(
                'labels' => array(
                    'name' => __( 'Movies' ),
                    'singular_name' => __( 'Movie' )
                ),
                'public' => true,
                'has_archive' => true,
                'rewrite' => array('slug' => 'movies'),
                'show_in_rest' => true,
      
            )
        );
    }
    
    add_action( 'init', 'create_posttype' );
    

    The staging site has a lot of customization. So I setup a local testing site (fresh 5.9.2 install with 2022 theme) and did the same as above. I registered a post type with CPT UI and one with the code above. I checked the source code and in both cases the single custom post type did not include breadcrumbs or any other schema markup.

    I am not sure where to check next?

    Thank you very much for your help!

    Kind regards
    Yannick

    • This reply was modified 2 months, 3 weeks ago by ja4st3r.
    • This reply was modified 2 months, 3 weeks ago by ja4st3r. Reason: Code still messed up
    Plugin Author Sybre Waaijer

    (@cybr)

    Hi Yannick,

    Sorry for the delay.

    I am curious, why did you assign the built-in taxonomies category and post_tag for post type post to master?

    Anyway, you must assign a category to a post before the breadcrumbs display. WordPress force-assigns a default category to the built-in post type post but somehow doesn’t do that for your custom post type master.

    Thread Starter ja4st3r

    (@ja4st3r)

    Hi Sybre,

    I dont mind the delay. Thank your for your time!

    I am curious, why did you assign the built-in taxonomies category and post_tag for post type post to master?

    It was just for testing, I want to use custom taxonomies, but it was simpler to test with the default ones.

    Anyway, you must assign a category to a post before the breadcrumbs display. WordPress force-assigns a default category to the built-in post type post but somehow doesn’t do that for your custom post type master.

    Thank your for clarifying. I didnt know that I need a category to display breadcrumbs. I created the custom post type without support for any taxonomy. I think in this case WordPress is not able to assign a default category and the breadcrumbs dont work.

    Just on final question: The breadcrumbs are based on the taxonomy assigned to a post type. So it is not possible to create a breadcrumb that includes the Archive page? E. g. Home Page --> Archive Page --> custom post

    Plugin Author Sybre Waaijer

    (@cybr)

    Hi there! I’m back and active once more; again, sorry for the delay.

    Just one final question: The breadcrumbs are based on the taxonomy assigned to a post type. So it is not possible to create a breadcrumb that includes the Archive page?

    Not with The SEO Framework, no. You’d have to create a custom breadcrumb script and disable the one from TSF. I might give more options or at least code flexibility for this in the future, as the Schema.org scripts are due for a refactorization.

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