• I’ve tested a few custom post type plugins (having post formats support).

    ISSUE: While editing any CPT entry if I want to view those changes and click on ‘Preview Changes’ button, it throws a 404 error.

    The URL which throws 404 error is something like this …

    https://www.example.com/cpt-name/post-name/?preview_id=559&preview_nonce=0a0feaeab7&post_format=gallery

    Now, if I remove post_format=gallery parameter from this URL, it works just fine and displays the post. Why is it so?

Viewing 2 replies - 1 through 2 (of 2 total)
  • I’d like to know this too. I can’t seem to find an answer.

    I worked out you can use the preview_post_link filter to just remove it. Example:

    function replace_preview_link( $url ) {
    	if ( get_post_type() != 'myposttype' ) {
    		return $url;
    	}
    
    	return str_replace( '&post_format=standard', '', $url );
    }
    
    add_filter( 'preview_post_link', 'replace_preview_link' );
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘'Preview Changes' in CPT with Post Formats throws 404 error’ is closed to new replies.