The following hook is called when the plugin is activated from the dashboard.
register_activation_hook( __FILE__, 'myplugin_activate' );
function myplugin_activate() {
//create a variable to specify the details of page
$post = array(
'post_content' => 'content', //content of page
'post_title' =>'title', //title of page
'post_status' => 'publish' , //status of page - publish or draft
'post_type' => 'page' // type of post
);
wp_insert_post( $post ); // creates page
}
Related Posts:
- Pass PHP variable to javascript
- Best way to manage a lot of pages in Wp Admin [closed]
- Create page when plugin is activated
- How can I show drafts in wp_dropdown_pages list?
- Pages with 2 Columns
- WP-PageNavi plugin doesn’t work with multiple pages of search results
- Is there a way to lock certain pages from being edited by anyone other then the admin?
- Replace existing pages with new pages, keep menu links
- How to show category images (from plugin) on a regular page (page-example.php)?
- [Plugin: Posts 2 Posts] How does it work?
- Custom Text Under Navigation Links
- Set a category for a page
- Copyright messages for a particular set of pages
- Show a special message for private page?
- How can plugins have their own pages?
- wordpress reusable content blocks
- Add a plugin before main container
- Wondering what these multi-colored extra pages are?
- View Private Published Page with URL Code (no login required)
- Do action only on certain front end pages?
- How to delete page by deactivating plugin
- WordPress web pages keep getting deleted (moved into the trash) by themselves
- Run plugins only on certain pages
- (FES EDD) New vendor submission page is blank
- WordPress plugin/theme or other wayout to create portable pages?
- php page not found for plugin options menu
- Changing page URL and connect newsletter to MailChip
- WordPress page and plugin list using sql query
- How to add subcategories to the blogroll?
- Can I allow certain people to add/edit pages within a parent?
- Proper way to replace the_content only for pages created by custom plugin
- Add menu page issues (permissions & position)
- Would Gutenberg be considered a PlugIn?
- I need help locating a URL that is on my site map, but that I can’t find in my WordPress dashboard
- Show author on every sub-page
- How to have sample page for each new register users in a membership website
- One sub site is slow while all others load fine, same theme & plugins [closed]
- Add Content to Content()
- Simulating a wp page – wp page load sequence
- How to create wordpress page that lets users create their own quiz? [closed]
- Huge number of 404 pages getting spawned
- Change website directory safely to add a static page on startup
- Price comparison table based on Custom Post Type?
- How to dynamically change spots of text in custom page?
- Custom page in plugin visible in menu
- Adding a pagenavi to function for displaying bookmarks
- Pasting this PHP breaks my page. Why?
- Modify pages widget and make a plugin?
- How do I create pages within a WordPress post?
- Woocommerce checkout page broken when set as a checkout in woocommerce settings [closed]
- Elementor Combined all Sections into 1 Text Editor
- Custom plugin places html head content in body
- Pass PHP variable to javascript
- Use get_pages() before another plugin modifies it
- how to show all posts of each category in pages
- Give custom page template a custom post ID
- Bookmarking custom template pages which all have the same page ID
- create pages automatically and dynamically in wordPress
- Randomize post (and page) IDs on generation
- WordPress Frontend Page using Plugin
- Automatic chage password of pages after some time
- Powerpress upload a podcast without creating a post for it
- Allow a page to be edited by a specific custom role
- How to Disable Auto Executing Script in A Particular Page Only
- Failed to load resource: the server responded with a status of 500 () post.php
- catch urls with specific pattern and show specific content for them by plugin
- Page Contents showing in Footer Area
- Page takes on two different formats
- How to disable users to view Other pages
- Add_Meta_box to custom page (formidable edit post)
- How to remove a css class for any wordpress page
- Get content and send to 3rd party
- Multiple calling javascript from shortcode in one page
- Best approach to serve static content within a regular page
- History of page, interval of years
- Choose default template for a page with code
- Hidden Some Setting on Post or Page [duplicate]
- Get page content by ID (from a plugin)
- Better code/text editing for posts and pages?
- Restrict my pages from public
- How to set up php,javascript and css to allow for our finished product to be displayed within a page?
- How to tell which Plugin is displaying?
- Create a blank admin page from plugin
- Wp Pagenavi how to display all results
- Fake Single WordPress Post (Page) Loop
- How to set different users for different pages?
- WordPress ultra slow if I click on posts?
- Redirect url in plugin to somewhere else?
- Display static pages instead of category, in code
- How to make only selected posts appear on a selected wordpress page
- Static page with formatted post list
- Additional scrollbar appears inside the browser on every page + lag scroll -Winner theme
- Attachement title in wpallimport
- Update title field while listing wordpress page titles in Elementor selector
- WordPress Plugin and other pages not opening
- How to access the page without registering in wordpress
- Set the Social Icon Size in footer
- ImageMagick on wordpress 6.5.5 for Linux Alma 8 success but which no magick
- Remove 3rd party plugin notices from within own plugin
- Show only those pages that are created by the specific logged in user in WordPress