use $wp_insert_post function to create posts and to create sub posts of this use this function again and set post_parent = “name of post you created” see list of all arguments and usage of this function wp_insert_post
Related Posts:
- Handling error states with admin_post
- get_the_content if it contains multiple lines it results in SyntaxError
- Looking to exclude blog posts from category Previous/Next buttons
- Insert code when users come from an specific referer
- Automatic Excerpt Not Working
- How to display related posts from parent category
- Make custom field meta not display if there is not data in it
- How to migrate the posts from an old custom legacy blog to a new WordPress website?
- Get_the_author doesn’t return author name
- Hide wordpress field if data is empty in post!
- How can I use wp_query to show all product data using just the products ID?
- Trying to add attribute to my posts’ featured image
- How to set a min number of words for a blog post
- Loop through categories and display posts title under each dropdown
- How to store post ID’s in cookie or session to display the same posts later
- Post + form + action + results on the same page
- Post repeating with infinite scroll
- retrieve post data and insert it in seperate static html page without WordPress
- Why am I getting a different filename? And how does WordPress load singular.php for both Page & Post? (Fresh WordPress installation)
- Returning data instead of echoing/printing
- Display related posts without a plugin
- Counting Search results, and displaying the offset per page
- Count posts on multisite with blog id
- Function works everywhere, how to keep it to execute when creating a new post
- Making (and edit existing) posts with ID included
- Parsing Menu Items and Blog Posts
- How to show an entire post content and not also the excerpt?
- WordPress query undefined offset in loop
- Find Site ID From WP_Post
- WP_Query: getting posts where custom field exists
- Reading settings in the home page precisely home.php
- get post id from wp_insert_post for get_template_part
- Modify main query before it run without pre_get_post
- Displaying list of posts in category page
- .html end of URl affected to SEO?
- How can I get “Previous” and “Next” to show in the navigation besides the links?
- Displaying content on posts page based on category
- how to make an array of post id’s in is_single
- Loading Posts & Category with Ajax
- array_rand not working correctly?
- WP_Query() load selected post
- Unable to render custom field after attempt to generate a list of recent post in page template
- how to edit a specific post slug using a php code?
- How to pick “full/thumbnail” images in the loop?
- Why when I create a new post I found 2 record related to this post into the posts database table?
- Saving a post ID to use in a form elsewhere on website
- Prevent post from being published and show error
- Woocommerce Custom Meta Boxes- How to only display if they actually have content
- Pagination at category doesnt work with same name of page
- understand what code is doing when prepending /blog
- My worpress search page is showing no results
- duplicate posts with ajax load more wordpress
- My Custom Post Type AJAX Query is Returning no posts – why?
- How to display 8 posts in four columns and 2 rows on a carousel slide?
- Time Stamp In A WordPress Post Title That Does Not Keep Refreshing
- Don’t update modified post date when user add a product review or comment?
- Limit the number of characters/words in an excerpt for a related posts section
- Show a text if the post has written by author user role in WordPress
- Getting info about selected posts using one WP_Query
- Closing Comments conditionally in comments.php
- Change upload URL by mime type
- How to pull date/time in french format for wordpress post?
- Having trouble with customizing blog posts on the home page
- WordPress post insertion from PHP file
- How to display last whole post on the homepage
- How do if all posts has this category ID then do this
- Make sticky post with FacetWP
- WordPress Single Post Pagination Numbered and Navigational
- Getting page / post URL on publish and / or update
- Let user select the number of posts shown per page jquery error
- Add wp posts to cutom masonry grid
- Displaying 3 Category Posts differently
- Insert div after every three posts in home.php [duplicate]
- PHP tag in post content makes wordpress go crazy
- Unable to get Post Category Name and URL
- insert thumbnail image from php script
- ‘posts_per_page’ in costum page type
- Weird Behaviour: Not all WordPress Posts appearing
- Dynamic form variables for post meta
- List of child pages fetch next results at link click
- Adding category in wordpress – custom
- Query category-specific, paginated posts and allow viewer to change sort order
- Auto create description in post
- Trying to see if page is category or single and displaying title with appropriate heading tag
- Different image and background color depending on page type
- Posts sortable column not sorting properly for custom field numbers
- HOW TO Insert Existing PHP Code to WOrdPress
- foreach all the post
- How to list all the posts in a personalized page? WordPress
- Blog Posts not sorted and pagination not adjusted after filtering some category
- Disable single posts, but keep archive
- Add multiple HTML attributes to an Elementor button
- How to create a WordPress PAGE in another folder?
- How do I get a function to work in single.php
- Count the number of matching post names in foreach loop
- Need Help With Making Full-Width Template for Blog Posts (common methods aren’t working)
- Bulk data save in custom table
- How to change post date and post time in WordPress automatically with a function
- Display posts based on the selected category when no subcategory is chosen
- How to display only the first 2 words of a post title