• Pioneer Web Design

    (@swansonphotos)


    I had (long ago) asked here about a CPT that was not allowing a post to be previewed.

    I did find an answer at:

    https://wpmudev.com/forums/topic/preview-option-doesnt-work-for-custom-post-types/

    So, in:

    $args = array(
            'label'               => __( 'Faqs', 'text_domain' ),
            'description'         => __( 'Faqs', 'text_domain' ),
            'labels'              => $labels,
            'hierarchical'        => false,
            'public'              => true,
    		'publicly_queryable'  => true,
            'show_ui'             => true,
            'show_in_menu'        => true,
            'show_in_nav_menus'   => true,
            'show_in_admin_bar'   => true,
    		'supports' => array(
    		'title',
    		'editor',
    		'author',
    		'thumbnail',
    		'excerpt',
    		'trackbacks',
    		'custom-fields',
    		'comments',
    		'revisions',
    		'page-attributes',
    		'post-formats',
    		),
    		'taxonomies' => array('faq_category','post_tag'),
    		'update_count_callback' => '_update_post_term_count',		
            'menu_position'       => 5,
            'menu_icon'           => null,
            'can_export'          => true,
            'has_archive'         => true,
            'exclude_from_search' => false,
            'publicly_queryable'  => true,
            'capability_type'     => 'post',
    		'query_var'          => 'qa_faqs',
            'rewrite'             => array('slug' => 'faqs'),
        );

    just remove one line:

    'post-formats',

    and the preview works!

    Is there a better work around?

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    ATM, no, other than identifying the root cause and fixing it ?? It seems the problem remains. I’m able to replicate the problem as described in your linked reference. I don’t even see the formats meta box in the block editor, I had to use classic editor for testing. Apparently post formats haven’t been getting much love. Removing support is hardly a solution if you really want to use formats.

    I recommend filing a Trac ticket about this so the issue can be properly tracked.

Viewing 1 replies (of 1 total)
  • The topic ‘CPT Preview not working’ is closed to new replies.