Title: Can&#039;t edit page after using shortcode
Last modified: August 19, 2016

---

# Can't edit page after using shortcode

 *  Resolved [rich_c](https://wordpress.org/support/users/rich_c/)
 * (@rich_c)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/cant-edit-page-after-using-shortcode/)
 * 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)

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/cant-edit-page-after-using-shortcode/#post-2061745)
 * 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](https://wordpress.org/support/users/rich_c/)
 * (@rich_c)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/cant-edit-page-after-using-shortcode/#post-2061817)
 * 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](https://wordpress.org/support/users/fbarret/)
 * (@fbarret)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/cant-edit-page-after-using-shortcode/#post-2061940)
 * 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.

 * ![](https://s.w.org/plugins/geopattern-icon/display-last-posts.svg)
 * [Display Last Post(s)](https://wordpress.org/plugins/display-last-posts/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/display-last-posts/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/display-last-posts/)
 * [Active Topics](https://wordpress.org/support/plugin/display-last-posts/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/display-last-posts/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/display-last-posts/reviews/)

 * 3 replies
 * 3 participants
 * Last reply from: [fbarret](https://wordpress.org/support/users/fbarret/)
 * Last activity: [15 years, 1 month ago](https://wordpress.org/support/topic/cant-edit-page-after-using-shortcode/#post-2061940)
 * Status: resolved