[resolved] How to remove "post_format" parameter from preview url (2 posts)

  1. Rick
    Posted 2 years ago #

    I recently ran into a problem of preview links not working (getting a 404 or page not found message). Went through all the usual suspects and couldn't find a solution. I came across this support ticket and tested it on my site. Removing the post_format parameter from the preview url fixed the problem unfortunately, removing the post format support was not an option for me. I just needed to remove it from the preview url.
    Long story short, I put this function in my theme to do just that. Hope some of you find it useful:

    function post_format_parameter( $url ) {
    	$url = remove_query_arg( 'post_format', $url );
        return $url;
    add_filter( 'preview_post_link', 'post_format_parameter', 9999 );
  2. Jeroendebeurs
    Posted 2 years ago #

    I ran in exactly the same problem and solved it with your code, so very useful indeed. Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic