Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • macropolo

    (@macropolo)

    I’m also tried to figure this out, and I find the solution.
    To achieve this result you should change variable value in “wp-math-captcha/includes/class.core.php”.

    Change
    $rnd_input = mt_rand( 0, 2 );
    to
    $rnd_input = 2;

    And input box will always be at the end.

    Now all previews works perfectly, 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. 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.

    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.

Viewing 5 replies - 1 through 5 (of 5 total)