• Resolved jberta

    (@jberta)


    Hi,

    When creating a post, after saving as draft, I use the ‘preview email’ feature to receive an email preview of the post being edited.

    This used to work fine, but since the latest update, I now receive an email of the previous post (the last I published), instead of the current one (the one I’m currently editing).

Viewing 12 replies - 1 through 12 (of 12 total)
  • @jberta

    Which editor are you seeing this in?

    Thread Starter jberta

    (@jberta)

    Hi,

    I’m not sure I fully understand the question.
    Do you mean between the visual editor and the code editor ?
    In that case the answer is ‘visual editor’, using the ‘subscribe2’ side-bar ‘preview’ button

    Julien

    @jberta

    I mean are you using the Block Editor:
    https://developer.ww.wp.xz.cn/block-editor/

    Or the Classic Editor (via older version of WP or plugin):
    https://ww.wp.xz.cn/plugins/classic-editor/

    Thread Starter jberta

    (@jberta)

    Then block editor, thanks for the clarification

    J

    @jberta

    I think this is because the process to send the preview email is happening before the post save, even though a post save event is triggered in the code before the preview email even is called.

    That may well take a fair amount of investigating to figure out a fix.

    Thanks for the report.

    @jberta

    It could also be related to server caching if Json responses. You might want to check caching plugins and your .htaccess file are not caching the REST API system.

    Thread Starter jberta

    (@jberta)

    Thanks for the tip.
    I doubt that cache enters into the equation: we have no cahcing plugins, and this is a very ‘vanilla’ install of WP

    @jberta

    I can partly reproduce this issue, I can add a new paragraph on a draft post and send a preview and the new paragraph is omitted from the email, if I click Preview again it works – that is due to the asynchronicity of the Editor in saving the post and sending the email, it’s just saving too lat.

    I have added a small delay in my code to the email preview sending and it works, I’m just not sure it’s the optimal or correct approach.

    Thread Starter jberta

    (@jberta)

    Ok, would you mind sharing where you made the change and what it was ? I can test ‘in-place’ and tell you if that fixes it here

    @jberta

    Okay, there are going to be a few steps to this:

    1/ Edit the file at plugins/subscribe2/gutenberg/sidebar.js
    2/ Fine the line that says:
    apiFetch( { path: '/s2/v1/preview/' + postid } );
    3/ Replace that line with:
    setTimeout( function() { apiFetch( { path: '/s2/v1/preview/' + postid } ); }, 250 );
    4/ Save that file.
    5/ Copy that entire file to clipboard
    6/ Edit the file at plugins/subscribe2/gutenberg/sidebar.min.js
    7/ Paste the contents of the Clipboard over-writing that entire file.
    8/ Save this file too.
    9/ Load your browser and force reload all sources – usually Shift and click refresh
    10/ Test if it has worked.

    Thread Starter jberta

    (@jberta)

    Sadly, that did not fix it (no change in the final behavior).
    Thanks for trying!

    J

    @jberta

    Weird, it worked well for me. And having just tested again it still works okay.

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

The topic ‘Preview email sends previous post (not current)’ is closed to new replies.