Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Saving Data Via Ajax into posts - Wordpress

Goal

Fetch Data from and external source and save them as posts in a WordPress site.

I want to learn and code a plugin which can fetch data from an external source and save it in my WordPress. I can fetch data using curl, and save them using wp_insert_post command.

But, still could not find a workaround to do the data insertion with an button click.

So, If anybody can help me on following it would be great.

  1. How I can initialize the function which consist of the wp_insert_post, and show a success message, with the titles of the posts inserted. if fails obviously an error message.

  2. If the post title already exists, overwrite it rather creating a new post.

Some help would be appreciated.

thanks .