0

So I am wanting to show the wp-admin/post.php?post=999&action=edit Inside my custom template of the single.php and page.php.

So I understand that I can do it using an iFrame by basically get_the_ID() of the current page and passing the URL of wp-admin/post.php?post=999&action=edit in the src of the iframe...

for example:

<iframe seamless="seamless" scrolling="yes" src="<?= get_bloginfo(url); ?>/wp-admin/post.php?post=<?= get_the_ID(); ?>&amp;action=edit" allowfullscreen="" frameborder="0"></iframe>

However, I do not want to completely access the wp-admin from an iframe, causing a cycle of a "looking into mirror-to-mirror effect" with iframes-to-iframes.

I've also thought that if I used an Iframe, then I would have to write a jquery script to capture all <a> and turn them into an onclick function to send the link to the:

window.top.location.href = url;.

If there is a better way to access the edit page screen from the template, please let me know...

My goal is to make the wordpress admin completely show on frontend of site

  • Do you actually, specifically, want to include all of wp-admin/post.php in a page/post? Or do you really just want to be able to create posts from the front end? If it’s just the latter, then this would not be the right way to go about it. – Jacob Peattie May 3 at 19:11
  • You can create a post in PHP via wp_insert_post, or via the REST API in javascript ( that's how the block editor does it ). There are also security concerns – Tom J Nowell May 3 at 19:13
  • @JacobPeattie Yes! I want to specifically include wp-admin into a frontend. I don't want to create posts, just edit them. – samjco May 3 at 19:13
  • @TomJNowell I've written a script using the Rest API to pull in posts... I just want to edit them from the frontend utilizing WP default admin features... The MAIN reason why I want to use the frontend is to use the permalink structure for pages: domain/parent/child/gchild/ggchild and don't want to use wp-admin/post.php?action=edit........etc – samjco May 3 at 19:19
  • 1
    This sounds utterly complicated, bloated and not very secure. Imho, I'd pull in the posts to the frontend, write some small ajax to update the database on save. Then you have your clean permalink structure, also there is a plugin "frontend-posts". Just sayin'. – user3135691 May 3 at 20:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.