How do i fetch post content and featured image from a child site and save it to localstorage

Hi there!
new to MainWP here.
What I am trying to acheive is fetching the post content and featured image to localstorage of the browser by using the child website id and post id on the child site “not the post id on mainwp”.

Why am I using child post id not the mainwp post id? cause I couldn’t get that one lol.
so we want to build this function now fetchPostContent($child_post_id,$website_id)
Our faild approach is here:
our current approach

This is causing an Ajax error with a 500 server error.

The Main Goal is to click that btn and save chosen post data to local storage and later pass it to the add new post page so we can publish a post on another site.

Hey @ehab1993

Welcome to the MainWP community.

One of our developers (@kwcjr) will take a look at this and update you via this ticket as soon as he can.

Should you need any other help with the development of your custom solution, feel free to ask in our dedicated channels for developers in our Discord server.

Hey @ehab1993 glad to see you extending MainWP to your liking.

The error may be coming from this line here ( class-mainwp-post.php isn’t a file within MainWP Core )

include_once ABSPATH . 'wp-content/plugins/mainwp/class/class-mainwp-post.php';

image

If this is your main goal…

The Main Goal is to click that btn and save chosen post data to local storage and later pass it to the add new post page so we can publish a post on another site.

…this functionality is already available within the MainWP Post Plus Extension It’s experimental & may be a possible work around for your use case - but in case of some page builders, may not render correctly.

Once installed it will add a new option to the Post Actions menu named “Clone”. Selecting this option will allow you to then post to the rest of your Child Sites.

image

1 Like