Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    I wonder if the permalink rules didn’t get properly flushed after you created the post type.

    Could you just simply visit your Settings > Permalinks page, don’t need to hit save or anything, just visit, and then retry previewing the post?

    Thread Starter dberz

    (@dberz)

    Thanks for looking Michael.

    No, the suggestion above does not work. The preview feature sill fails to load. Note that my permalink structure is site to “http://site.com.com/event-programs/sample-post/.

    Not sure if this is helpful, but when attempting to preview, the page first directs to http://site.com/event-programs/wp-admin/post.php, then pauses and errors out on: http://site.com/event-programs/good_event/brooklyn-uncorked/?preview=true&preview_id=13&preview_nonce=d4b689ec9c&post_format=standard

    I’m especially puzzled by the fact the preview partially works if I remove the post_format=standard bit in the URL…

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    That is a bit odd really.

    Can you verify that it works with a custom post type that wasn’t registered with our plugin? If it does, then I need to figure out how to debug where the issue is coming from, otherwise it could all be getting caused by something else in your install.

    i have the same issue to my custom post , i add a custom post name realization , i added post in that and when i click the preview or view realization its not showing the page , can you help me for this ./realisation/added/?preview=true&preview_id=998&preview_nonce=38e62a1786&post_format=standard .
    It showing me the error like This is somewhat embarrassing, isn’t it?
    It looks like nothing was found at this location. Maybe try a search?

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Where are you getting the preview link from in the WP Admin?

    My text CPT created with CPTUI is creating preview links like: http://wp.dev/wp/3.9/?post_type=movies&p=66&preview=true

    I have the same issue. Try removing &post_format=standard. It worked for me. Now I have to try and figure out how to remove it automatically…

    robgnyc

    (@robgnyc)

    Any other resolution to this issues?

    I can’t really have a client removing &post_format=standard from the URL.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Not sure I ever managed to recreate the issue, so I don’t have a solution.

    robgnyc

    (@robgnyc)

    I would be happy to give you a login to my site to take a look if there is a private channel to send it to you.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    michael @ webdevstudios.com

    I’m not convinced this is an issue specifically from our plugin, but I’m not saying it’s guaranteed not either.

    bbv

    (@bbv)

    I was having trouble previewing my custom post type pages using the “Preview Changes” button, too. Like you guys, “&post_format=standard” (where “standard” changed depending on the format I chose) was added to the end of the preview URL and my preview page displayed “Page not found”. I tried what others mentioned, to manually remove that parameter from the preview URL on my browser’s address bar. The preview worked and looked as it should, but I needed a more permanent fix.

    In CPT UI, I orginally had “Post Format” enabled under the Support setting for my custom post type. I first tried disabling it which caused the post “Format” section from the page editor to be removed and also stopped the post format parameter from being added to preview URL. However, I want to use Post Formats for my CPTs so that didn’t work for me. I reenabled Post Format support in CPT UI.

    Then I noticed that my regular pages and posts did not have the post “Format” section in the page editor nor the option to enable it in “Screen Options”. I added that in my functions.php file and found that I still had the same issue when previewing pages using Post Formats. I searched Google whether it was possible to not have the post format parameter added to the end of the preview URL and arrived at this topic:
    https://wordpress.org/support/topic/how-to-remove-post_format-parameter-from-preview-url?replies=2

    It works perfectly. Here’s the full code I used inside php tags of my functions.php file:

    // enables Post Formats for regular pages and posts
    add_theme_support( 'post-formats',
    	array(
    		'aside',
    		'gallery',
    		'link',
    		'image',
    		'quote',
    		'status',
    		'video',
    		'audio',
    		'chat'
    	)
    );
    add_post_type_support( 'post', 'post-formats' );
    add_post_type_support( 'page', 'post-formats' );
    
    // removes the Post Format URL parameters
    function post_format_parameter( $url ) {
    	$url = remove_query_arg( 'post_format', $url );
        return $url;
    }
    add_filter( 'preview_post_link', 'post_format_parameter', 9999 );

    If you don’t want post Formats enabled on regular pages and posts, you can use just Rick’s code from the linked topic and it will work as well.

    So from what I experienced, I think this is a WordPress issue rather than CPT UI, but I could be wrong as I’m not that versed in coding and didn’t dig deep into the root of the problem.

    Anyways, hope this helps!

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Cannot "preview changes" for custom posts’ is closed to new replies.