You can read more about the details of activation on this answer.
Basically you need to hook a function to register_activation_hook()
– assuming, that this is from within your main plugin folder and not a subfolder:
register_activation_hook( __FILE__, 'on_activation' );
function wpse65190_on_activation()
{
// Add an admin notice:
add_action( 'admin_notices', 'wpse65190_on_activation_note' );
// Then you should check the DB option:
$plugins = get_option( 'active_plugins' );
if ( ! in_array( dirname( __FILE__ ), $plugins )
{
unset( $plugins[ dirname( __FILE__ ) ] );
update_option( 'active_plugins', $plugins );
}
}
function wpse65190_on_activation_note()
{
// Add your note here: Maybe a form?
}
It’s as easy as that. You just have to fill in the gaps. If you got a full working example, please update this answer with your working code. Thanks.
Related Posts:
- Plugin Deactivate Self on Activation Errors
- Is any information available in PHP files in WP about plugin activation history?
- Uninstall, Activate, Deactivate a plugin: typical features & how-to
- How To Activate Plugins via Code?
- Activate a plugin through PHPMyAdmin or FTP?
- Delete tables from database when deleting plugin
- How to check if a theme is active?
- Pluggable function and activation check?
- Automatically install wordpress plugin at theme activation
- Function to activate WordPress theme inside a plugin
- Activate Plugin which is in subfolder?
- explanation for activate_plugin function in wordpress core
- Remote plugin activation hook
- Force plugin to fail activation
- WordPress register_activation_hook table creation not working
- Multisite: Activate plugin for subsites only?
- The plugin generated x characters of unexpected output, $wpdb not defined
- Correct way to use register_activation_hook
- Cannot run the code after I activate the plugin
- Why does deactivating a plugin cause error: “You do not have sufficient permissions to access this page”?
- Many plugins making WordPress run slow by design?
- wordpress in nginx docker container connected to php:8-fpm container and mariadb container isn’t creating any tables on plugin activation
- Unable to activate wordpress importer after installing it
- How to include plugin without activation?
- Auto add content such as pages upon plugin activation?
- Detect when any plugin is activated or deactivated
- How to automate wordpress plugin activate and deactivate by php logic?
- Default Plugin Settings Not Writing to Database
- Plugin won’t activate – cannot declare class (already in use)
- How to activate plugins for my WordPress sites from a remote server
- register_activation_hook with include file [closed]
- Prevent a plugin from being automatically activated
- Activated plugin is stored as an object, rather than as a path
- Own plugin corrups plugin-activation
- How to check if tables in WordPress still exists after activations
- How to block plugin activations with no known user or coming from unknown IP address range?
- Run plugins only on certain pages
- Are functions in main plugin file called before function bound to register_activation_hook runs?
- Force file download on plugin activation
- WordPress user account activation
- Multiple instance of data in plugin custom database table on plugin activation
- Why this function not working for install database on plugin activation
- register_activation_hook in oop approach
- How to create multiple database tables on plugin activation?
- Run function on plugin activation before plugin is loaded
- A question about register_activation hook
- rewrite_rules() not applying rules on plugin activation only after permalinks menu is clicked
- register_activation_hook() not working as expected
- Sub Plugin deactivation when Parent Plugin deactivate
- Advanced WordPress plugin activation detection
- Does Deactivating a Plugin Help Anything?
- Apparent errer when installing plugin
- Activate a plugin via a SQL query
- My plugin does not install correctly if a previous version is still installed
- Is there existing plugins to “Click-to-Launch” embedded Flash / SWF content?
- Activation flow of a plugin in a multisite environment
- How to run flush_rewrite_rules on activation after i register my custom post type using WordPress Boilerplate Plugin
- How to check for already existing plugin versions on activation? and prevent errors
- how to enable/activate a plugin per Cpanel
- My WordPress activation hook isn’t working
- Cannot modify header information – headers already sent during plugin activation
- Unable to to self-deactivate plugin using deactivate_plugins()
- Error Copying Directory On Plugin Activation
- WordPress hook source
- API calls on plugin activation or init?
- All plugins deactivated. What could cause this?
- Different plugins activated online and offline
- Problems with installing and deleting plugins
- Plugin De/Activation Not Firing On MultiSite install
- Custom Table doesn’t create on plugin activation
- Activate plugins by a theme’s functions.php?
- Is it possible to send user new password after they clicking on forgot password in word press
- why i cannot see some plugins while they are enabled on network admin page?
- Install theme as part of a plugin
- How to export comments in WordPress?
- Overriding Plugin Template Files with Child Theme
- What causes the “Are you sure you want to do this?” error with plugins?
- use WordPress theme / plugin editor in my plugin
- Plugin Development: WordPress processes twice on post update. How to skip process on the first?
- Fatal error: Class not found in
- Show “Local Pickup” shipping method only for specific Woocommerce product categories [closed]
- What user roles should have wp_unique_post_slug_is_bad_flat_slug filter applied?
- Plugin-generated pages use Not Found or Pages Archive templates?
- custom post type don’t appear in the home page
- Creating a functionality plugin to edit seriously simple podcasting
- in source code but I can’t find it in files or plugins
- How to add credit card validation check to wordpress [closed]
- How do you add a settings page to another menu?
- What plugin should I use to add Microformats to my blog
- Any way to change WP-PostRatings so you can only vote up?
- Replace old theme that understand old css (vcex_icon_box css_animation)
- ACF checkbox return format based on page
- How do I add a medium to the WordPress database with my own plugin?
- Loading a plugin in a post template without using wp_head()
- Store admin page into variable
- Vote It Up Plugin – Add ascending numbers to MostVotedAllTime Chart Function
- Choopy Video Playback in a popup using Artiss Youtube Embed [closed]
- How to send email when my plugin is activated?
- How to get URL param for pagination in shortcode?
- Using ACF to allow user to add and edit multiple saved forms