From stackoverflow: https://stackoverflow.com/questions/2450510/redirect-after-plugin-activation
register_activation_hook(__FILE__, 'my_plugin_activate');
add_action('admin_init', 'my_plugin_redirect');
function my_plugin_activate() {
add_option('my_plugin_do_activation_redirect', true);
}
function my_plugin_redirect() {
if (get_option('my_plugin_do_activation_redirect', false)) {
delete_option('my_plugin_do_activation_redirect');
wp_redirect(MY_PLUGIN_SETTINGS_URL);
}
}
Related Posts:
- Update Option Stored in Multi-Dimensional Array
- check if Gutenberg is currently in use
- WordPress Plugin Development – Headers Already Sent Message
- Get page content using slug
- Best practices for using the transients API
- $wpdb->insert_id
- Remove profile picture option (and other things) from profile.php (in admin)
- How to disable plugin update notification for a specific plugin in Multisite
- How Can I Add a Filter to Class Instance Only?
- Getting old term value with edited_{$taxonomy} | Hook
- How to add HTML / Form to an Admin Bar Menu
- Call activation hook multiple times
- Adding custom code into header.php using a plugin
- Building a better media uploader for WordPress
- Two-step login process – Is it possible?
- Calling clean_term_cache() fails when called in the same plugin that creates terms, succeeds when called separately?
- Is there any background process that I can run from plugin without depending on page hits on a website without affecting page-load speed?
- Woocommerce how to update variable product price programitically?
- Singular name Plugin localization
- Using $wpdb object in a widget
- Unified Approach for Placing Option Pages
- Define a function outside a class and call the function using action or filter hook
- Modifying WordPress plugins
- On plugin deactivation hide its shortcode
- Can I submit a plugin that follows the PSR-2 coding style guide?
- How to get current page id through the plugin
- WordPress removing data attributes for scheduled post
- How to restrict plugin’s sub-menu pages to admin/subscribers?
- WYSIWYG editor in WP 3.2 plugin
- Saving data from block editor to the database
- Verify Nonce returns false – Request Nonce returns correct value
- OOP Plugin and Menu – Call to undefined function register_setting()
- What is minimum time interval for which a cron be scheduled?
- How to untrash a post only if it was not a draft?
- Can I change header.php of current theme through a plugin function?
- Gutenberg blocks not getting styled on back end
- Writing a plugin which needs to upload files
- Calling is_single() outside the loop
- update woocommere total value on checkout based on selected payment method
- Loading WordPress Admin Environment
- how to add custom functionality after woocommerce place order button
- Problems with: manage_${post_type}_posts_columns
- Add a Save Button to Custom Meta Box [duplicate]
- Rich text editor settings persist throughout all rich text editors
- Function: Add link to / inside div
- How can I rewrite a URL to pass requests to a custom method via AJAX? (I can’t use admin-ajax.php)
- WP Gutenberg Blocks – How to limit first/root blocks
- Add a default WP comment form to forum template
- Gutenberg: import dependency or assign from global variable?
- How do I update a field of a meta box?
- Following WordPress Markup Is mandatory, got awkward resultyby wordpress standard markup?
- Steps to Update a WordPress Plugin That We Developed
- Using WAMP, trying to create a plugin, getting error: You do not have sufficient permissions to access this page
- Loading Modernizr (or other JavaScript libraries) for use in a plugin
- How do I remove folder and contents I have created while installing plugin
- Issue on Setting $icon_url Parameter on WP add_menu_page()
- Are there any official or unofficial guidelines for the styling of a widget?
- How to get error object returned by wp_create_user
- I have this error notice ‘wp_enqueue_script was called incorrectly’ in my plugin
- Logout after clicking URL link results in “headers already sent” error
- My WordPress Plugin code breaks customize.php viewpoint
- Make wordpress join default user metas with a column from another table while displaying the wp_users table on the users screen
- wpdb->get_var always returning 0
- A function that will remove HTML and tags from a string?
- $wpdb->prepare is not working like mysql_real_escape_string
- Enqueue ONLY Plugin Styles and Scripts
- Serial Number from custom table not appear in woocommerce_email_before_order_table action
- How to replace the existing metatag using the backend to insure a thumbnail image gets fetched when we share on social media?
- When setting styles to an extended block that was saved as a pattern, it doesn’t remove the style that was there
- Sanitization and validation input fields – Settings API
- A question on init and activation hooks
- Always hide a page from the menu
- Add custom html classes to gutenberg wrapper
- Author Meta in Author URL Link
- Warning: Illegal string offset ‘Andorra’ in … on line 106
- Update database record in plugin
- Different style for specific rows in custom list table using WP_List_Table
- get_comment_meta() for a filter hook in a plugin
- form does not generate $_POST request
- Callback function quicktags that uses variable in start tag
- Font Awesome stopped showing icons, shows &# text instead [closed]
- WordPress Plugin Tool Tip Helpers
- How can I add the Post ID to Class Name in Jquery?
- How to show metabox just in post.php in admin?
- Can I use a hook other than ‘init’ to handle form submissions?
- Managing Custom Designed Content
- Stop theme displaying comments
- $wpdb how can i save my postmeta table before querying it
- Plugin as custom page
- Can’t switch theme after activation
- Plugin capabilities
- plugin will not offer update even though a new version is available
- How do I replace title with my plugin?
- Deactivate plugin on registration
- How to filter manage categories listing
- Enqueue Script in custom plugin before other
- How to remove a class [closed]
- Find Any Theme’s page.php File
- WP Job Manager – Show recent jobs as cards
- Admin Menu for New Post