• Is there any option to add posts in WordPress backend without reloading whole page? It would make my work much faster and easier.

    I found some similar topics on Google, but I don’t get it. Step-by-step instruction would be much appreciated.

    Regards

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    There’s actually several options, but they’re too involved to offer a step by step here. The short answer is use AJAX. Create a form where you can enter whatever post data you need. When you submit the form an AJAX request is sent to WP so your form data can be inserted into your DB as a post. The original form page never reloads.

    AJAX with WP is a bit different than classic JavaScript AJAX. The basics are covered in the Plugin Handbook. The JavaScript/AJAX segment runs on for several pages. Your PHP AJAX handler essentially takes the form data, validates and sanitizes it, then assembles it into an array suitable for use with wp_insert_post().

    Posts can also be inserted through XML-RPC, REST API, and WP-CLI. I believe AJAX is the best documented even though it may still be lacking. If you’re still struggling despite the provided resources, don’t feel bad, it’s not an easy process to master. Don’t forget, you can quickly pay your way out of a jam by hiring help at jobs.wordpress.net 😉

    Thread Starter gkopowski

    (@gkopowski)

    Thanks for your answer!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Add posts in backend without reloading website’ is closed to new replies.