On a site I'm working on, in the profile page - for example - I have to display the content from a few custom posts (additional details, location details, billing). And instead of having the user click Edit and change the page to the 'edit page' for that particular post and then come back to edit the next one, I'm trying to display the edit form for the posts in a lightbox.

Up until now I am able to load the complete get_edit_post_link page into an iframe, that's basic but the drawback is that it includes the full page, header, footer and all which I don't need. And turning them off in CSS is not elegant at all. For the life of me, I cannot figure out how to get just the edit form from said page. That is, short of making a fopen to the edit page and getting the code from there, which is even worse than the CSS option IMO!

Including the edit form code into a lightbox would be ideal!


You could use jQuery's load() function instead of an iframe:

$('#target-div').load('http://www.mywebsite.com/page.php #section-to-show');
  • Thank you Pim, that works, but in my case the action of the form needs to be changed also, and probably there's something more in the backend that isn't allowing for proper post of the form. Probably it would work great for frontend forms not created through a plugin (like my case). I'm using the WPUF PRO plugin for these forms and going through its classes I found the WPUF_Render_Form->render_form which does the trick, and includes all the validation logic of the form. I have upvoted the answer but, since it's my first question I don't yet have sufficient rep to count. Many thanks! Oct 10 '16 at 11:18

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.