The codex entry you site is simply wrong! There are a lot of hooks fired before admin_init
during admin requests, not least of which is init
, which a lot of plugins use to do their initialization.
In particular, the TGM Plugin Activation plugin hooks into init
(with the default priority = 10) with a function that calls do_action ('tgmpa_register')
.
Hence, you’ll need to do something like:
// make sure we register this hook func with lower priority value than
// TGM Plugin Activation does
add_action ('init', 'sr_admin_init', 9) ;
function
sr_admin_init ()
{
if (!is_admin ()) {
return ;
}
// I NEED THIS TO TRIGGER FIRST
wp_die("sr_admin_init");
}
Edit
To be more charitable to the author of the codex entry you site: admin_init
is the 1st “strictly admin”-related hook fired for admin requests. It’s just not the 1st hook fired.
Related Posts:
- Where can I find a list of WordPress hooks?
- Whats worth using add_action when we can simply use add_filter?
- add_action(‘wp_ajax_[action name]’, myfunction) problem
- Hook on trash post
- Adding onload to body
- What is the earliest possible hook for safely using `is_front_page`?
- Send data to 3rd party api with wp_remote_post on wp_login
- How to customize the WP admin default help contents
- Hide gutenberg option blocks
- Difference between hooks Plugin_loaded and admin_int?
- admin_post hook not called
- deactivated_plugin hook: get the name of the plugin
- Is there a hook for user activation (after they click the email confirm)?
- Setcookie works on admin but not front end
- How to debug removal of rewrite rule flushing?
- function ‘wp_enable_block_templates’ not found
- Bulk action hook for admin pages which uses WP_List_Table
- How to pass arguments to add_action() [duplicate]
- How to hook into user registration process Before user registers
- WP Admin Bar frontend issue with dashicon deregister
- A good way to add a different background image for each page?
- Searching a hook which triggers when deleting a post to get all comments
- add_action for lost_password or modify wp-login.php?action=lostpassword
- Add my own function to existing WooCommerce hook
- @wordpress/hooks use to add actions/filters within multiple plugin
- Firing a function AFTER redirect
- How can I customize the upload error message in WordPress?
- WordPress hook that gets featured image from direct URL?
- How to get session token of current user in wp_login hook?
- Why is save_post hook being called twice despite all my efforts?
- Delay an action until current action is completed
- How to properly setup an activation hook
- How to remove scripts/style added to customize_controls_enqueue_scripts hook by current active theme
- What’s hook to use immediately after a user is authentcated [duplicate]
- Hook before posting via JSON REST API
- add_action for unknown custom post types
- How to prevent double execution of do_action statements
- When is the {$new_status}_{$post->post_type} transition hook fired?
- TinyMCE as comment editor – encoding issues
- Hook to change Logout url
- How to exclude a list of specific category in category widget in new post admin screen?
- Method to find a hook
- Understanding WP
- Get post or page id early
- Strange behaviour with add_{$meta_type}_metadata | add_post_metadata filter
- Looking for a hook for post.php
- Executing Arbitrary Code at a Specific URL without Creating a Post or Page?
- Update a costume wp_usermeta key back to 0 every 24hours (time can be specified as needed)
- customize_controls_enqueue_scripts doesn’t fire from within my plugin
- Save User Meta Email Address in Lowercase
- When are wp redirect methods safe to hook?
- WooCommerce single product page quantity description [closed]
- Execute JavaScript in WordPress Hook
- How to cancel the trash action inside wp_trash_post
- wp_insert_post_data hook should be called before updating db but isn’t
- What is the difference between add_action and add_filter [duplicate]
- load-* hook for dashboard
- What conditions must be met in order to upload .zip file to a multisite WordPress installation?
- How to hook code in ?
- wp_enqueue_script before wp_head
- Is it possible to add the_content filter upon login?
- Add Different Actions To Different Page’s wp_footer
- Getting the post ID in parse_query
- Remove genesis_404 hook from genesis_loop [closed]
- What hooks do I need to hook into to capture ever wp_user creation/change?
- Is there a before_save_post hook or something similar
- Neccessary to call add_submenu_page and add_menu_page from admin_menu hook?
- Adding custom Bulk Actions
- Print results of a WP_Query to wp-admin/upload.php within ‘delete_attachment’ hook?
- upgrader_process_complete filter not fired using ajax updates
- How to debug wordpress hooked functions?
- Is there a way to Insert a post to post list?
- “Intercept” enqueing of 3rd party’s JS file
- How to call do_action() to pass arguments to hooked functions that take different number of args?
- WP hook to add custom content after the_title()
- Is it likely that do_action will have unexpected results?
- How to export category name and category link in wordpress json
- Error later wordpress 5.3.2 update. Please help
- How to abort a save operation with a WordPress hook?
- wp_get_current_user Not working
- is_page not triggering
- admin_post_(action) hook create console log error
- Check if front page within function passed to action
- Hook after creating a post and retrieve infos from this post immediatly
- Display custom debug info inside page and not before head
- $new_pass always returns null – password_reset hook
- How to resolve 500 error in post listing page?
- Object oriented programming, add_action in constructor not firing
- Get new (not old) post inside transition_post_status hook
- How to Show Different Information to your authors/contributers
- Cannot override hooks.php
- Removing action from template class
- Remove “enqueued” script from array
- Function is Missing an Action Hook
- How to access variables in the function where apply_filters() is called?
- How to change Akismet commenter privacy notice?
- How To Apply Different Styles To All Blocks Based on Post Meta Value?
- PHP Notice: wp_enqueue_script was called incorrectly. Scripts and styles should not be registered
- getSaveContent.extraProps hook for core/post-title doesn’t add new attributes on to the frontend
- Use wordpress search hooks to search a second database