• Resolved airlinereporter

    (@airlinereporter)


    Hey Dominik,

    Great plug-in that I use all the time. I just recently upgraded to the new version: 2.0.1 and now it won’t work. It shows up just fine and let’s me copy the link, but when someone tries to view it, I get: “Not Found: Sorry, but you are looking for something that isn’t here.”

    Also, my google ad, which is normally on the right bar, now shows up on my header. Any ideas?

    Thanks,
    David
    Airlinereporter.com

    https://www.ads-software.com/extend/plugins/public-post-preview/

Viewing 15 replies - 1 through 15 (of 24 total)
  • Plugin Author Dominik Schilling

    (@ocean90)

    WordPress Core Developer

    Which was your previous version?

    Similar problem: preview links now only work for logged in users and result in 404 otherwise. The url seems to have changed:

    Old (v2.0.1) of the plugin):
    https://example.com/?p=2012041336&preview=true&preview_id=2012041336&public=1&nonce=1ae17b81c2

    New (v2.0)
    https://example.com/2012/09/02/post-title-string/?preview=1&_ppp=e42872b7c6

    I reverted to 2.0 and the same behavior exists. Thanks!

    I have found that if I replace the permalink structure with ?p=POSTIDHERE, the preview links work for non-logged in users. So I wondered if it had something to do with the htaccess/permalink rules. I disabled my caching plugin that modifies that file, but I couldn’t remove the issue. I have started to deactivate other plugins, but to no avail. It seems intimately tied to permalinks and user login hooks, so perhaps my custom theme + new plugin update is the culprit?

    Plugin Author Dominik Schilling

    (@ocean90)

    WordPress Core Developer

    Thanks for your comment mike.
    I will try to figure out what’s going on there.

    Could you please post your permalinks setting and which cache plugin are you using?

    Me too. Fully updated. Link gives a 404 error.

    Hi Dominik.

    I’m noticing the same thing. Since you haven’t yet received a response from mike, I can at least provide you with my settings:

    using W3 Total Cache and just the ‘post name’ permalink setting (/%postname%/)

    I haven’t messed around yet with disabling things to test it out. But I can confirm that a preview link that isn’t using mod_rewrite (i.e., manually changing the provided preview URL to the querystring vars instead) works fine, while the permalink structure does not.

    This of course refers only to users who are not logged in, since all logged in users on my site have permissions to view previews for the post_types in question (this is a custom post_type I’m working with so far, by the way — though I assume it would be no different for ‘post’). Also potentially pertinent: the post_type uses a rewrite value too, though it is not visible in the post or preview permalinks, it is provided in the ‘register_post_type’ call.

    I’ll be looking into a hook to rewrite the permalinks without the mod_rewrites if you aren’t able to find a fix. Perhaps ‘preview_post_link’ depending on what your code does.

    Thank you!

    Thanks for the reply:

    /%author%/%year%/%monthnum%/%day%/%postname%/

    (this is a bit quirky)

    and using W3 Total Cache, however, disabling it doesn’t fix things. My users now solve this problem by replacing the permalink in the preview url and finding the postID to revert to the old format. Works that way, but a bit clunky!

    For anyone looking into the same problem, I’ve just discovered that I don’t have to remove the permalink structure, I can just append the &p=[post_id] directly to the preview link provided for success. Works for my permalink structure anyhow which is fairly simple /%postname%/.

    Dominik: one way that you may be able to help fix this in future releases is by adding the preview_post_link and/or preview_page_link filters to your get_preview_link method.

    An example from /wp-includes/meta-boxes.php : post_submit_meta_box() is as follows…

    $preview_link = get_permalink( $post->ID );
    	if ( is_ssl() )
    		$preview_link = str_replace( 'https://', 'https://', $preview_link );
    	$preview_link = esc_url( apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ) ) );

    That is the code used for the preview button in the submit/publish metabox on the edit post page. With that filter in place in your plugin, those of us affected could hook into it and add the required p var.

    Hope that’s a helpful start.

    AEG-wiz: That hack to append the &p=XXXX works for my quirky permalinks. It is a much easier hack than earlier.

    Plugin Author Dominik Schilling

    (@ocean90)

    WordPress Core Developer

    I still can’t reproduce your problems. Tested with your permalink settings and default settings from W3 Total Cache,

    With version 2.0 the preview link was reduced to just the needed args, which are p and _ppp. p contains the post id and _ppp the nonce.

    Example: https://wp34.dev/?p=16&preview=1&_ppp=ef22678f2c

    So if you already shared your links with version < 2.0 with a longer nonce time, yes, these links won’t work any longer. That’s intentionally.

    Taking a look at mike’s post again, I’m not sure if you mixed the versions. The change between 2.0.1 and 2.0 just was this line.

    So if somebody has some more details on how I can reproduce the issue please write me a line, either here or to dominik DOT schilling AT gmail DOT com.

    Plugin Author Dominik Schilling

    (@ocean90)

    WordPress Core Developer

    Are you all using the “WordPress SEO by Yoast”? Do you have activated the option “Redirect ugly URL’s to clean permalinks. (Not recommended in many cases!)” under SEO-Permalinks?

    If so, please add _ppp to the input field under “Other variables not to clean:” and check if it helps.

    I don’t have that plugin. Here is my list

    Akismet
    Better Blogroll
    FD Feedburner
    Get Author Profile
    Hide or Show Comments
    Image Caption
    IntenseDebate
    Jetpack
    Latest Posts by Author
    Scheduled M.I.A.s
    Simply Exclude
    Sucuri Security
    Text Control
    Vaultpress
    W3 Cache
    Wickett Twitter Widget
    WP Print
    WP Touch

    Phew, that’s a lot!

    Plugin Author Dominik Schilling

    (@ocean90)

    WordPress Core Developer

    I did a small restructuring of the plugin.
    (https://plugins.trac.www.ads-software.com/changeset/599022/public-post-preview)

    Could you please test the dev version and check if the problem still exists?

    https://downloads.www.ads-software.com/plugin/public-post-preview.zip

    Hi Dominik.

    I was a bit confused by your earlier post made 2 days ago, but if I am reading it correctly you are saying that the preview links are not expected to be rewritten as permalinks, based on your code logic. I downloaded the zip you provided above, and tested the links again.

    I am seeing the following behavior: My preview links get rewritten with the permalink structure with preview=1&_ppp={nonce} appended. If I add the p={post_id} parameter back onto the URL it works fine for public preview (NB: adding the p parameter to the permalink structure and submitting it to the browser then redirects the URL back to it’s non-mod_rewrite state). But as provided, the preview link does not work.

    This is some improvement over testing problems I encountered yesterday, but so far it appears that the ‘p’ parameter is always converted into the permalink structure instead.

    Also, I am not using the plugin you mentioned above – nor anything similar. I did disable all plugins earlier in my testing without impact on Public Post Preview.

    Here’s an example of my permalink structure:

    Custom Post Type: portfolio (rewritten to ‘directory’)
    https://wp.mydomain.com/?p={post_id}&post_type=portfolio
    gets rewritten to:
    https://wp.mydomain.com/directory/{post_name}/

    Preview link provided by plugin:
    https://wp.mydomain.com/directory/{post_name}/?preview=1&_ppp={nonce} DOES NOT WORK FOR PUBLIC PREVIEW

    adding ‘p’ parameter back:
    https://wp.mydomain.com/directory/{post_name}/?preview=1&_ppp={nonce}&p={post_id}
    automatically redirects to:
    https://wp.mydomain.com/?p={post_id}&post_type=portfolio&preview=1&_ppp={nonce} THIS LINK DOES WORK FOR PUBLIC PREVIEW

Viewing 15 replies - 1 through 15 (of 24 total)
  • The topic ‘[Plugin: Public Post Preview] Stopped Working’ is closed to new replies.