<?php
/*
Plugin Name: Activation
Description: This display notice message test plugin
Author: Nanhe Kumar
Version: 1.0
Author URI: http://nanhe.in/
*/
class Activation {
public static function init() {
add_action('admin_notices', array(__CLASS__, 'text_admin_notice'));
}
public static function text_admin_notice() {
?>
<div class="notice notice-success is-dismissible">
<p> TEST MESSAGE</p>
</div>
<?php
}
}
add_action('init', array('Activation', 'init'));
Your message not showing because your class constructor is not executing you can test through add die in your constructor then you can better understand what is happening.
Related Posts:
- Call activation hook multiple times
- How to output message during plugin activation
- Inserting Taxonomy Terms During a Plugin Activation?
- Add a new tab to WordPress Plugin install Listing
- Changing Plugin Load Order
- Admin settings update updating every time home page is hit?
- Global Objects and Public Methods
- How should you hook a session_start() when authoring a plugin?
- Init action hook running late after PayPal’s return url?
- How do you use the plugin boilerplate loader class to hook actions and filters?
- How Do I Load My Action Earlier Enough?
- Does WP fire delete_post when trashed posts are automatically deleted?
- Why does do_action pass a blank string as the first parameter if no $arg is set?
- Using wp_cron with custom time interval and the register activation hook
- How to add a link to WordPress Plugin install Listing
- I can’t find where a hook is being defined in a plugin – Easy Digital Downloads
- How do I handle multiple Submit buttons in plugin’s option page?
- Two-step login process – Is it possible?
- How can I hook into existing WordPress Bulk actions?
- Hook for post permalink update
- Only allow plugin to be activated on root site of multisite
- Get returned variable from a function to add_shortcode function
- why creating tables using $wpdb is not being executed while installing plugins?
- Earliest WP Hook to Safely and Reliably Redirect
- Define a function outside a class and call the function using action or filter hook
- Create a plugin to change the action to which a function is hooked
- Can I differentiate between “Delete Post Permanently” and “Empty Trash” and do something for each accordingly?
- Synchronize Custom post type tags to WordPress default posts tags
- comment_email hook doesn’t seem to work for comment editor field
- unable to stop loop when using wp_insert_post with publish_post hook
- Hook into theme-switching later than `setup_theme`
- Is it possible to delay execution of shortcode output callback?
- WordPress Ajax callback function from plugin – OOP
- Settings not set after calling register_setting()
- Why my database table not created on activation?
- How do I change the initial quantity of a product in woocommerce?
- Act on user meta updated, but only once
- Where and how does WordPress store and use its plugin and hook information?
- Is there any way to allow a plugin to write over a previous version?
- edit_{$taxonomy} | Hook
- WordPress after content Hook & external template part
- best practice for query string values – get_query_var always empty for my value supplied in query string
- get_current_screen() return null
- Modifying meta tags after doing ajax call in plugin
- how to add custom functionality after woocommerce place order button
- Where to add hooks in a class
- Insert terms for custom taxonomy on plugin activation, or each page load (init hook)
- How to use output buffering in WordPress hooked functions?
- Conditional hook based on the core function that is calling it
- Adding option to Gallery shortcode
- do_action and add_action on two different installed plugins won’t work
- I have 2 plugins using the same wp_login action hook and one is not working
- Add a new confirmation page before saving
- How dynamic action login_form_{action} is working
- What happens when two or more plugins use the same hook?
- How to get all queries’s results after they have executed?
- Add Link Category on Activation?
- flush rewrite rules after plugin update?
- Add child pages to submenu automatically
- After plugin activation hook
- Odd map_meta_cap $args on post edit — sometimes integer, sometimes string
- How can I create a custom plugin that allows anonymous users to signup without registering?
- hook filter after the_content on a specific page
- Is there an admin hook that will let me read GET variable before it’s too late to set the header Location
- Associate multiple email addresses with the same user account, so they can log in with either
- Run command “composer install” when activating wordpress plugin
- Multiple array for post_content on plugin activation
- Custom filter not working
- Configure WordPress to Generate Scheme-less Relative URLs
- Ajax +wordpress onClick link redirect to new page and create html content
- Clean way to initialize plugin in newly-added site when plugin has been network activated?
- How to replace settings in WordPress plugin from a theme
- Activate / Deactivate plugin
- Creating posts with links from a txt file
- Action / Hook when a new plugin is added
- apply_filters() and call_user_func() to define and call a function outside a class
- Getting Post ID at “stylesheet” and “template” hooks
- Trigger function on Remove block or add new block in Gutenberg JavaScript
- Limit get_next_post to posts from the same author
- Any way, hook to add content right before the “read more” link?
- Is there any way to get post meta from publish_post hook?
- How do I ensure I can loop through every enqueued script and CSS?
- WordPress Fatal error: Uncaught Error: Call to undefined function dbDelta()
- Problem in plugin debuging in wordpress
- OOP development and hooks
- Plugin Development – Call to undefined function comment_exists()
- Add_action not calling callback function
- Prevent plugin activation and add admin notice
- Does WordPress have something like timer hook?
- Can I use a hook other than ‘init’ to handle form submissions?
- Template file structure , wordpress hook for altering the template
- How do I replace title with my plugin?
- Looking for Hook that is fired after a plugin or wp upgrade is installed/updated
- Deactivate plugin on registration
- Woocommerce: block user removing cart item
- Apply function on all action hooks?
- How can I get a plugin to hook ‘dbdelta_queries’ — a filter used during version update?
- Send retrieve password notification email with custom HTML email template
- Trigger a JavaScript function based on the data fetched from Woo commerce hook
- Is there a canonical way for a plugin to install a mu-plugin or drop-in?