Viewing 15 replies - 1 through 15 (of 16 total)
  • Ah! Thanks for the heads-up, folks, and sorry about the delay (I never seem to get notifications until someone mentions my name, annoyingly. Better solve that).

    Just fixed in 0.7.25.

    Thank’s Michael!

    It seems like this issue still exists when using custom post types. It still only happens when trying to preview the drafted posts. Any help would be appreciated.

    I confirm, issue exist in 0.7.25, and in my case, it appeared in last version. With old versions I didn’t have any problem.

    I have same problem…

    WP : 4.5.3
    Custom Permalink : 0.7.27

    Plugin Author Sami Ahmed Siddiqui

    (@sasiddiqui)

    Hi rhk9103, macropolo and Sébastien COLLET

    As you guys are saying that the issue is still exist but, i am not able generate this error. I have checked the default post type as well as the custom post type but still unable to generate this error.

    Please take some time from your busy schedule and guide me that how i can produce this error. Till then i can not do anything to make this issue as resolved.

    Thanks,
    Sami

    Hi Sami. I just tried few versions, I replaced custom-permalinks.php without deactivating plugin. When I upload 0.7.24 everything works perfect, but when I upload 0.7.25 or higher previews not working and instead I see 404. Previews work with posts in any version, problem appear with page preview and custom post type preview.

    Hi Sami
    do you want an WP admin access to a local copy of the site ?

    Plugin Author Sami Ahmed Siddiqui

    (@sasiddiqui)

    Hi macropolo and Sébastien COLLET,

    Thanks for your reply.

    macropolo, As you said i have created sample page with the title “Draft Page”
    and save it as draft. After i click on the preview button so, it shows the following permalink “https://www.example.com/?page_id=22&preview=true” and show the correct data but when i try to access https://www.example.com/draft-page so, it gives me the 404.

    This is exactly you guys are saying?

    Sébastien COLLET, Yes i want the WP admin access to view the issue. If you hve any dev server so, kindly provide me the access for the time being so, just i can check issue there.

    Thanks,
    Sami

    This is exactly you guys are saying?

    Yes, I suppose.

    I create page
    https://www.example.com/foo
    save it as draft, and when I press “Preview” I see it without problems
    https://www.example.com/?page_id=4779&preview=true

    Then, if I change url for something different, for example
    https://www.example.com/foobar
    link in for preview became
    https://www.example.com/foobar&preview=true
    and since then I see 404, because url redirect to https://www.example.com/foobar

    I found the piece of code that causes this issue

    From line 187:

    if ( $posts[0]->post_status == 'draft' ) {
          $originalUrl = "?p=" . $posts[0]->ID;
        } else {
          $originalUrl =  preg_replace( '@/+@', '/', str_replace( trim( strtolower($posts[0]->meta_value),'/' ),
                        ( $posts[0]->post_type == 'page' ?
                            custom_permalinks_original_page_link($posts[0]->ID)
                            : custom_permalinks_original_post_link($posts[0]->ID) ),
                         strtolower($request_noslash) ) );
        }
      }

    When I replace this part in lastest version with old code from v 0.7.24 previews of pages works.

    Old code:

    $originalUrl =  preg_replace( '@/+@', '/', str_replace( trim( strtolower($posts[0]->meta_value),'/' ),
                      ( $posts[0]->post_type == 'page' ?
                          custom_permalinks_original_page_link($posts[0]->ID)
                          : custom_permalinks_original_post_link($posts[0]->ID) ),
                       strtolower($request_noslash) ) );

    But, also I found out that previews of posts not working with old code.

    So with version 0.7.24 I can preview pages, but not posts. And in version 0.7.25 and higher I can preview posts, but not pages.

    Hi Sami
    OK to send you an access to dev server, how contact you in private ?

    Plugin Author Sami Ahmed Siddiqui

    (@sasiddiqui)

    Hi Sébastien COLLET,

    You can contact me through my email address or skype whatever is feasible for you.

    Email: [email protected]
    skype: sasiddiqui91

    Thanks,
    Sami

    Plugin Author Sami Ahmed Siddiqui

    (@sasiddiqui)

    Hi macropolo and Sébastien COLLET,

    By the help of guys i have fixed this issue. You guys can check the latest version of the plugin.

    marcopolo, In this version you can see both of the previews (posts + pages)

    Thank you so much for your help guys ??

    Regards,
    Sami

    Now all previews works perfectly, thanks Sami!

    Plugin Author Sami Ahmed Siddiqui

    (@sasiddiqui)

    You welcome marcopolo ??

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Latest version does not work with post preview’ is closed to new replies.