WordPress.org

Forums

WP REST API (WP API)
[resolved] Retrieve custom post from one site and insert it into another (3 posts)

  1. robert.glez
    Member
    Posted 1 year ago #

    Hello,

    I have a client who wants to interconnect two wordpress sites of his, in which there is the custom post type "car". He would like to be able to retrieve a car post from one site and insert it into the other, via admin panel.

    Would this be achieved with the JSON REST API at its current stage? I mean can I interconnect the two systems like that? Of course the admin panel would have to be developed by myself, I'd only like to know if it's possible.

    Is there any documentation as a starting point for this API? I feel a bit lost.

    Thank you very much.

    Best regards,

    Robert

    https://wordpress.org/plugins/json-rest-api/

  2. Ryan McCue
    Member
    Plugin Author

    Posted 1 year ago #

    Hi!

    That should certainly be possible, however you'll need to write the logic to bring it across yourself. Theoretically, you could do something like...

    $response = wp_remote_get( 'http://example.com/wp-json/posts/4' );
    $new_response = wp_remote_post( 'http://example.org/wp-json/posts' );

    With regards to documentation, take a look at the GitHub repo for that.

    Thanks.

  3. robert.glez
    Member
    Posted 1 year ago #

    Thanks a lot Ryan for putting me on track

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.