WordPress recommendations for the register_activation_hook hook are:
- Don’t do
echodirectly in theregister_activation_hookcallback function. Do it other hooks likeinitoradmin_init - Make sure you are closing the PHP tag
?>. Otherwise, you will get theHeader already sent notifications.
I have tested your code, I think you are closing the PHP tag ?> at the end of the file.
Related Posts:
- No Error Log File, no debug info
- How should one implement add_settings_error on custom menu pages?
- Prevent notice and warnings in error_reporting?
- How to log plugin errors to plugin error_log file
- Catch own Exceptions
- Throw 403 in a plugin [duplicate]
- why don’t I get error messages in admin when developing?
- WP_Error handles errors, but how can I show success with a message?
- Settings API – Undefined Index when unchecking checkbox
- Error : “Updating failed: The response is not a valid JSON response” with custom shortcode
- How can I display an error message after post has been saved?
- Execution limit and Memory limit errors even i changed to 1024M and 600(cache.php,load.php)?
- Proper way to pass credentials in a custom login form to avoid “headers already sent”
- Two functions utilizing registration_errors filter
- How can I gracefully escape an error condition?
- WordPress debug messages not displaying
- Custom Post Type Object – Undefined Variables
- Reporting errors in a shortcode plugin
- What might be the reason of Couldn’t fetch mysqli_result on another domain?
- Plugin can’t be activated [closed]
- How do I debug an error that a plugin is causing?
- Need Help Determining Where Header Error is Happening
- “Rendering of admin template [path to template] failed”
- Is there any way to pass messages from a script to a redirect target in a hidden fashion?
- Import images remotly run through timeout error
- Error code when migrate
- WPGut – Updating failed and shortcode?
- GET request return value as error instead of success
- WP_Fatal_Error_Handler OR WP_Error OR try/catch
- Custom Plugin activation error in Multisite
- Warning: Illegal string offset – on homepage
- Plugin error on activation – breaks page encoding and prints the code of plugin php files
- Getting error of unexpected output during activation
- Trying to build a plugin – Cannot modify header information
- Should I use wpdb prepare?
- error_log() output for print_r() appearing on page
- Is there a limit on making calls to WordPress.org API’s?
- Vagrant script to setup all the common PHP / WordPress version combinations
- What is the etiquette on extending a plug-in
- Add Dividers or Separators Between Nav Menu Items
- Overide get_template_part( ‘partials/post’, ‘sidebar’ ); with a plugin
- Change Media Uploader default directory
- Clarity needed on usage of multiple 403 forbidden header() functions at the beginning of the plugin files
- Load visual editor without custom styling
- Can i do plugin commits directly from a plugin folder inside an installation using the Trunk SVN
- register_activation_hook() not activate plugin
- Multiple textdomains
- Dynamically Override Fancy Title
- Use a PHP file as action for a form in a WordPress plugin, what’s the correct way?
- Set a specific page as 404 – not found via my own plugin
- Adding Automatically To In WordPress Using Filter Referencing?
- Activation hook not creating table
- wpColorPicker is not a function!
- Best plugin for most viewed post [closed]
- What could cause my plugin’s options/settings page not to load?
- Plugin Upgrade Strategy
- Which are the hooks run before/after when a category’s deletion?
- Disable The Events Calendar plugin from loading its scripts
- get_the_excerpt() not working in plugin loop
- How to remove images from my plugin page in WP Directory?
- Is there an additional block.json property to set to get an InnerBlocks child to respect the “supports” property?
- Plugin with action ‘save_post’ needs to press publish twice on order to publish
- WP Editor Issue in Backend
- Issue with contextual help overwriting existing content
- Inserting code to HTML view from a pop up initiated from visual view
- CSS not affecting widget output
- Using a custom shortcode from within the template of a shortcode plugin
- Trying to get class to instantiate ONCE (or, “why do I keep punching myself in the head?”)
- How to create a WordPress Plugin that has it’s own “page”?
- Create Widget or Enable Shortcodes in Sidebar
- WordPress publish_post hook not getting featured image and meta on first publish, but works on updating title
- How to add custom view links to wp-admin/post.php?
- how to create category with code in wordpress using form
- Get post thumbnail in WP_Query
- Is it possible to have instead mypage.com/?page_id=81 to have mypage.com/cool/?
- User Data Handling between two plugins
- Woocommerce place order update shipping price
- wp_schedule_event not executing function call, even with add_action
- How to query a nested field in wordpress api using _fields param
- function add custom fields to media gallery
- ajax response strips multidimensional array and unable to decode
- Using AJAX to submit and return data inside the WordPress Plugin Boiler Plate framework
- The Events Calendar featured image as body background?
- using wordpress acf shortcods in tables goes outside the table
- Pass javascript result to shortcode executer function
- How to display archive by selecting year and then selecting month
- Ajax call not working with
- What is more secure checking capabilities of user or checking role of user in WordPress plugin development
- Undefined notice on unset field
- Theming Custom Plugin Page
- From my Plugin Settings Page use check boxes to load specific css files (e.g. Bootstrap / Foundation)
- Script work on non logged in user but not work for logged in user?
- Sessions in plugin development?
- Can wp_schedule_single_event be used to run background proccess?
- Is it possible to make WordPress as a RESTful app?
- Get user logged in status from within a plugin. $current_user not defined
- Widget plugin and input file
- How to inject html to every page with a plugin?
- Custom plugin not appearing
- Add a custom image source