• Resolved rich_c

    (@rich_c)


    The shortcode works on a page, but you can’t edit the page afterward. It redirects to the last post.

    You have to disable the plugin to edit the original page. It seems like the shortcode function is taking over the page title, permalink, and content on the page edit function.

Viewing 3 replies - 1 through 3 (of 3 total)
  • i would think, you should be able to edit the page directly from the dashboard.

    general:
    it sounds as if the plugin is not taking care to leave the original $post object unaltered;

    imho, this should work:
    edit display-last-post.php in the /plugins/display-last-posts/ folder;

    change this:

    global $post;
    	$myposts = get_posts('numberposts='.$nb.'&order=DESC&orderby=post_date');

    to:

    global $post; $temp_post = $post;
    	$myposts = get_posts('numberposts='.$nb.'&order=DESC&orderby=post_date');

    and this:

    endforeach;
    
    		$retour.='</div> ';

    to:

    endforeach;
    $post = $temp_post;
    		$retour.='</div> ';

    (untested)

    Thread Starter rich_c

    (@rich_c)

    Thank you alchymyth. That worked.

    I guess the functions get_permalink(), the_title(), etc., change the _POST data, in addition to returning the data. I noticed that ALL the last post shortcode examples I found on the internet did the same thing.

    Odd that no one had ever noticed that when you try to edit a page with the code in it, it “takes over” the edit and redirects you to the post itself, not the original page.

    If the author updates his plugin he will have something unique.

    Plugin Author fbarret

    (@fbarret)

    Hello,

    I’m the author of the plugin.

    Thanks for these contributions!

    In the last versions of WordPress, a Modify link appears in the new top bar (when you’re logged) – this redirects directly to the current page in the editor interface.

    The Modify link that appears after a post included by the plugin redirects to the post…

    In any case (even in an old version of WordPress), it isn’t necessary to deactivate the plugin to edit any post or page in the editor interface! This plugin can not make a content inaccessible in the WordPress dashboard. As said by Alchymyth, you can anyway access to all your content directly in the admin / editor interface.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Can't edit page after using shortcode’ is closed to new replies.