0

I have a theme which appears to have broken previewing posts. When I preview a page/post I get a 404 error.

If I change to another theme previews work fine again so it must be something in this theme.

I can't work out when/if I would have broken previews. Going through my filters and actions I can't see anything obvious.

Has anyone had a similar problem/ What did it turn out to be?

4
  • Sounds like it may be an issue with query arguments or some other rewrites added by your theme. Can you provide the values returned by the code below. In your theme's header.php file, add this: <pre> var_dump( $_GET ); </pre> <pre> var_dump( $_POST ); </pre>
    – sMyles
    Commented Sep 28, 2016 at 16:09
  • Also, can you provide an example URL that you are using for the preview?
    – sMyles
    Commented Sep 28, 2016 at 16:12
  • It's unlikely this can be just randomly guessed, you are better off contacting theme's developers/support.
    – Rarst
    Commented Sep 28, 2016 at 16:34
  • it may be also something with the plugins you use that shows particularity when using that exact theme. have you tried disabling the plugins?
    – prosti
    Commented Sep 28, 2016 at 20:55

2 Answers 2

1

This is just a shot in the dark without knowing more like sMyles said. Try saving (flushing) your permalinks. If you have recently changed the structure of your URLs, simply by going to Settings > Permalinks and click Save Changes might resolve this issue.

1
  • Tried that already. Doesn't fix the problem.
    – Arcath
    Commented Sep 29, 2016 at 7:40
0

I found the answer.

It was only for post-formats on pages. The issue was that I needed to also register the taxonomy post_format on pages as well in the init action.

I have updated the wiki page to reflect this. https://codex.wordpress.org/Post_Formats#Adding_Post_Type_Support

// add post-formats to post_type 'page'
add_action('init', 'my_theme_slug_add_post_formats_to_page', 11);

function my_theme_slug_add_post_formats_to_page(){
    add_post_type_support( 'page', 'post-formats' );
    register_taxonomy_for_object_type( 'post_format', 'page' );
}

Not the answer you're looking for? Browse other questions tagged or ask your own question.