For testing purposes you can use the log system (php_error.log):
error_log('Plugin activated', 0);
// Check for DB table existance
if(!$this->hasDBTable()){
error_log('Database not present', 0);
if($this->createCELabelsDBTables()){
error_log('Database was created.', 0);
} else {
error_log('Error creating the CE Labels Plugin db tables!', 0);
}
} else {
error_log('Database OK', 0);
}
To output error to the user without the “Headers already sent” error, you can use the php function trigger_error:
trigger_error('PLUGIN OK',E_USER_ERROR);
With WordPress must always be E_USER_ERROR or it won’t display the message.
I know the error_log works perfectly since I’m using it, but the trigger_error displays to must information. Try it and see for your self 🙂
Related Posts:
- How to redirect to settings page once the plugin is activated?
- Prevent network activation of plugin
- Inserting Taxonomy Terms During a Plugin Activation?
- Using wp_cron with custom time interval and the register activation hook
- Call activation hook multiple times
- Only allow plugin to be activated on root site of multisite
- why creating tables using $wpdb is not being executed while installing plugins?
- Override pluggable functions in a plugin?
- Plugin activation error due to unexpected output
- Settings not set after calling register_setting()
- Insert terms for custom taxonomy on plugin activation, or each page load (init hook)
- Add Link Category on Activation?
- WordPress Plugin Activate / Deactive Failing
- Multiple array for post_content on plugin activation
- Class cannot be found, but it’s available in the file, I get: Fatal Error: Uncaught Error: Class ‘Blocks\Base\Activation’ not found
- Plugin can’t be activated [closed]
- Clean way to initialize plugin in newly-added site when plugin has been network activated?
- Activate / Deactivate plugin
- WordPress Fatal error: Uncaught Error: Call to undefined function dbDelta()
- Custom Plugin activation error in Multisite
- How to store in the database directly the translation?
- Unable to show a message after plugin activation
- Refresh or redirect page after activate my plugin
- I can install my plugin in localhost but not in my server
- WordPress plugin tables become corrupt
- Deactivate plugin on registration
- how can a plugin return an error message on activation?
- Is there a canonical way for a plugin to install a mu-plugin or drop-in?
- My activator class isn’t running the code inside
- 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
- How to prevent Composer dependency conflicts amongst WP plugins?
- Using a plugin class inside a template
- Change admin language based on user (in single-site)
- Widget development – Drop down options won’t save
- Global Objects and Public Methods
- Check for featured image in WP_Query
- Enqueue script only when shortcode is used, with WP Plugin Boilerplate
- add_filter OO with parameters
- dbDelta ALTER TABLE syntax?
- Some nav-menu filters do nothing
- Shortcodes, output buffering, and WordPress functions
- Auto update specifick plugin
- Get returned variable from a function to add_shortcode function
- What is the difference between current_page_parent and current_page_ancestor?
- Tips for targeting widget dragable for WP Pointer on widgets.php page
- Any ideas how to make unit test read the theme functions.php?
- Scheduling a task using class methods
- Add a panel to edit post
- Auto-Update Plugin Creating .tmp directory, not overwriting old version
- Cannot update …/tags folder in SVN Repository
- Is there a way to ensure plugin script loads before another script?
- ORDER BY wp_post custom column name in wp_query
- Verify if user is wordpress logged in from another app since wordpress 4.0
- Is it necessary to sanitize plugin options?
- 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
- Writing a wordpress plugin and trying to include the Facebook PHP SDK
- how to invoke wordpress API from other existing PHP system
- How to cancel update messages from a changed plugin
- How to get the post excerpt using post object?
- 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
- How to call code when adding WooCommerce menu items via woocommerce_account_menu_items
- jquery in wordpress plugin with depdendency
- 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
- 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
- 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
- Settings API not Saving to Database or Display
- Error using @wordpress/create-block to create multiple blocks on Windows