Why do you need to create a page?
Its possible that before plugin deactivation, the page no longer exists, so your deletion function will need to check for if it exists
But yes you will need to store the ID somewhere.
Best option is to just update_option(‘icreatedapage’, $pageid);
if ($pageid == 0) {
echo "Something went wrong. Could not successfully add a new page.";
} else {
update_option('somename_relatedtoyour_plugin_name', $pageid);
}
Tho what do you do if you page fails to create?
You will need to considering including instructions on how to manually create it, or let the user do it themselves…
Related Posts:
- How to get the path to the current theme?
- Post meta vs separate database tables
- How to add a javascript snippet to the footer that requires jQuery
- Enhance Media Manager for Gallery
- Inserting Taxonomy Terms During a Plugin Activation?
- Replace audio/video enclosure with player?
- wp_mail is undefined
- How do you use the plugin boilerplate loader class to hook actions and filters?
- Contact Form 7: wp_mail doesn’t work after update to 4.6
- Gutenberg ServerSideRender is deprecated, how to work with new wp.serverSideRender component?
- How to: Rest endpoint returning empty object
- Ensuring a plugin is loaded/run last?
- Turn revisions off in plugin instead of config.php?
- Add an image gallery to a custom post type?
- Unit testing wordpress plugins with plugin options
- Create a clickable name in WP_List_Table for Plugin Admin
- Plugin development without Theme adjustments?
- How to Make a Category Always Selected?
- Script to remove all inactive widgets?
- Disable $title in Plugin Options Screen?
- WordPress Localization and Templating
- DIR vs URI when defining a path to a file
- Why after a file is programmatically deleted, is there still a reference in the media library?
- Can’t we use strings defined as PHP constants if we want to translate them in a plugin?
- JS / JQuery form validation in backend admin menus
- My new WordPress plugin version is not showing up in the plugin directory. It’s been 4 days what could the problem be?
- Is using register_activation_hook required?
- Synchronize Custom post type tags to WordPress default posts tags
- Tabbed navigation for plugin options using same row in database for all?
- Ethics question: what qualifies as a fork? [closed]
- How can I prevent my plugin’s next version from updating one of the files?
- How to i18n text coming from the db or from an external source
- Plugin settings not saving
- Is there an action like ‘after_register_custom_post_type’?
- How to replicate Media Library “Add New” on Plugin Settings Page
- How to get results of subcategories also?(WP Rest Api v2)
- Add code inside specific wordpress standard function
- dbDelta using Foreign key not working on update [duplicate]
- How to stop your plugin from executing on certain pages?
- Is it necessary to sanitize plugin options?
- Search the product by tag or category not working
- How to filter content for specific content variable
- PowerPress mobile media player
- You do not have sufficient permissions to access this page on a submenu
- WordPress function get_the_terms() returns ‘Invalid taxonomy’ error
- Trying to Implement .pdf File Upload in Admin for plugin
- Writing a wordpress plugin and trying to include the Facebook PHP SDK
- Codex Version Focus on Production or Nightly?
- How to cancel update messages from a changed plugin
- How to get the post excerpt using post object?
- Fatal error: Uncaught Error: Call to undefined function convert_to_screen()
- How to import the css in the plugin admin area?
- how to get the post id in plugin
- What’s the impact on WordPress’ performance regarding the amount of classes/files in a plugin?
- Using add_sub_menu to put into Appearance Section
- Using AND and bracket grouping in SQL not working
- Taxonomy archive page listing terms instead of posts
- How to call code when adding WooCommerce menu items via woocommerce_account_menu_items
- jquery in wordpress plugin with depdendency
- How do I force a download in the admin area?
- add_action wp_ajax_ not loading in plugin file WP Network
- Plugin creation, restricting access to specific roles
- wordpress automatic update does not run
- How to avoid conflict of plugin style and theme style?
- Ajax +wordpress onClick link redirect to new page and create html content
- How to move an image in a plugin to the upload directory and make it as a media of wordpress?
- Is it possible for two WordPress plugins to share the same code base?
- Script to replace default blogroll with links to my social media URLs
- wp.media libary pdf type
- Add multiple checkboxes as single field to Custom Shipping Method Settings Page
- Posts form with AJAX request – Plugin development
- register_meta not showing custom post type metabox data in rest api
- Want to know how to reveal a WordPress theme, considering the theme name is hidden?
- Save meta box data from selected dropdown list in bbpress reply form
- Sanitize WordPress Array Input?
- Events Manager: Create custom Placeholder for use in Email notification
- WC REST API Error Handling
- Using the same class across multiple functions
- Change Label of custom post type
- woocommerce add a new bulk action in the bulk actions dropdown in the orders list
- Creating a virtual page without exit
- Ajax Response Error | just getting error as the response
- admin-ajax.php returns “No Script Kiddies!” sometimes
- Widget won’t be activated
- Building WordPress Themes With Bootstrap with Adi Purdila → TutsPlus
- Allow user to change homepage
- Need to change buddypress profile url by add_rewrite_rule
- Generate activation url
- Use different archive template for plugin
- Get custom wp_query search results to appear on search.php
- Is it safe to use PUT and DELETE requests
- Multi-part form and wp_redirect()
- Sharing changes to a post (preview changes) with another user
- URL rewrite parameter lost (add_rewrite_rule)
- PHPUnit Ajax Serialization of ‘Closure’ is not allowed
- Settings API not Saving to Database or Display
- Error using @wordpress/create-block to create multiple blocks on Windows
- Find Any Theme’s page.php File
- Is it smart to require_once wp-admin/includes/plugin.php when you need only one function from it
- multiple record insert creating many duplicate records