Get content from posts and paste on page
-
Hi everybody,
Here what i need to do:
Check if some posts are draft(or private) with category X.
Check if page with X title exists
If exists add the content of the post, if not add a page with X title with the content of the post.$args = array( 'post_type' => 'post', 'orderby' => 'title', 'order' => 'ASC', 'post_status' => 'draft' ); $posts_array = get_posts( $args ); foreach($posts_array as $key => $value){ $posttext = get_the_content($value->ID,'', true); $postcate = get_the_category($value->ID); $postitle = get_the_title($value->ID); if ( is_page( $postcate ) ) { $pageA = get_page_by_title( $postcate ); } }
But I am stuck on create/ update the page, some suggestion?
- The topic ‘Get content from posts and paste on page’ is closed to new replies.