From what I understood from your question, you will need to use register_activation_hook()
, which runs when your plugin is activated.
register_activation_hook(__FILE__, 'your_function_name');
then in that function you can use `wp_insert_post’ to create your page.
Refer this link to pass new post parameters as per your need: https://developer.wordpress.org/reference/functions/wp_insert_post/
Edit:
In your plugin file make a function for shortcode.
function function_for_shortcode(){
//Your html here
}
add_shortcode('your_shortcode','function_for_shortcode');
Now when you run register_activation_hook
, provide to wp_insert_post
, post_content
as [your_shortcode]
.
Related Posts:
- Autoloading & Namespaces in WordPress Plugins & Themes: Can it Work?
- How can I add an image upload field directly to a custom write panel?
- Creating a table in the admin-style?
- What process do you use for WordPress development? [closed]
- On the WordPress Admin section how do I link to submenu pages created for a plugin?
- How to return only certain fields using get_posts()
- Where to put third party PHP library?
- Add a new tab to WordPress Plugin install Listing
- Export data as CSV in back end with proper HTTP headers
- Scheduled events disappear from events queue
- How to integrate a PHP webmail script into the backend of WordPress?
- How to log plugin errors to plugin error_log file
- Custom Post Type Link from Plugin
- How to Get a List of Sub Blogs without Using get_blog_list()?
- Using wp_cron with custom time interval and the register activation hook
- Conditional check to see if a bootstrap.css is included in a theme
- Throw 403 in a plugin [duplicate]
- WordPress multisite apply different options over each site from same plugin
- Using ob_start() in plugin
- Create Element From Dynamic HTML String [closed]
- Can I add pages to my custom menu via script?
- How can I view all WP generated thumbnails in Media Manager?
- Only allow plugin to be activated on root site of multisite
- what is the best practice for including ‘wp-includes’ classes
- Custom Plugin Database relations
- Save user-specific options in WordPress admin
- Why is print_r returning $classObj->userObj in several places on site
- How to put placeholder text in the main post input area?
- How can i get the title i specified in add_options_page for my header
- use __($str) to translate strings (symfony/twig)
- Is there a way to list tags order by post_meta field
- how to redirect to another post without getting headers already sent error?
- Redirect user to a particular link in 10 seconds after using wp_die
- Change template dynamically
- add a class when login
- Proper way to run wp_query from inside a plugin
- Programmatically detect if wp-cron is disabled?
- Buddypress function and global $bp question
- Custom plugin: Loop through taxonomy types and update columns for all types?
- Widget is to be compatible with all themes
- How to create a table with filters for my plugin
- Maximum lifetime for nonce
- How to Display my HTML form in my Custom Plugin?
- wp_insert_user() function password never match
- How to setAttributes in Gutenberg block?
- Adding rewrite rule dynamically
- Prevent third party plugin’s admin page access based on user type
- Use just a shortcode from another page
- I have 2 plugins using the same wp_login action hook and one is not working
- Using a multiple element in widget form
- How can I avoid conflicts between plugin and theme?
- How to control an elements classes from multiple Gutenberg sidebar controls?
- Update Data parameter of a wp_localize_script() call
- Download button in a plugin’s settings page
- $wpdb->prepare with LIKE and sprintf
- Why in this archive page that call query_posts() function show only the last 10 posts?
- Quasi-custom API Call Plugin
- Data not insert and update through ajax and jQuery in admin page?
- Show content without a post
- WP ajax requests not stacking?
- Full documentation about $args for register_rest_route?
- Is it possible to load the css just on my plugin admin page?
- WP Plugin with Upgrade option
- How can I control if post updated
- How to create taxonomy without using register_taxonomy () function
- AJAX call returns ‘testtest0’ instead of ‘test’ – why?
- Why is the form not updating when I select a new sector from the list?
- How to change a field in database through a submit button or Checkbox? [closed]
- Grandchildtheme (plugin) add header.php (not exist in child theme)
- How do I add a menu item to a Pods admin menu?
- $wpdb->update Issue
- Is there a way to add a link with add_post_meta?
- How to Show Category List With Corresponding Links?
- Import images remotly run through timeout error
- How to make every image title equal to alt text(wordpress/woocommerce)?
- Load specific page when a custom URL is hit
- Getting incorrect filepath inside custom block front-end output using @wordpress/create-block tutorial
- How do I add a 5 digit ZIP code validation to a Contact7 form?
- HTMLCollection not counting right in editor? / for loop not working on elements in DOM
- Trying to rename a file upload as the hash of file content on wordpress
- How can we stop showing short code in create or edit post section
- Getting products information, in woocommerce based on products ID
- Delete Plugin Options with Verify
- How can I measure CPU and RAM used by my theme or plugin
- want to confirm popup with “Yes” and “No” button when user click on add to cart
- set a custom post type to a taxonomy term programmatically in metabox
- Modify search form with plugin
- How to display properly exception or echo string after posting in plugin?
- How to create custom frontend php page via plugin
- How can I add recent posts to menu like mashable
- When using an options array the Settings API isn’t creating the database record
- the correct way to use options from settings page [closed]
- Changing upload directory for plugin uploads only
- How do I query posts and have their related taxonomies returned in the results?
- On one of my sites a file is shown as 404 but the file IS there
- Update option hook not firing
- $_GET vs get_query_var()
- Extend WP_List_Table class – Edit wp_usermeta – WPPB.me Boilerplate – Action error
- Reinitiate Gutenburg’s blocks using javascript
- Generating Multiple Divi Pages from Database