how do I programically create a page in WordPress if it doesnât exist already?
Leave a Reply
You must be logged in to post a comment.
how do I programically create a page in WordPress if it doesnât exist already?
You must be logged in to post a comment.
Based on that comment, you want to hook a function to your plugin’s activation hook, which inserts a WordPress post object into the database;
How will you identify that
page
? Assuming you have a specific title, use something likeIf you need help with wp_insert_post, please comment.
You can implement a function that intercepts the template_redirect action/filter, and inside that function include the theme’s header and footer, while creating your own content to put into the body of the page. See the API link (above) for an example.
Here’s a tutorial on the web.