The locale
hook happens long before init
. To see when which hook, variable, constant, function, class or file is available install my plugin T5 WP Load Order.
You get a looong file with a very detailed log. Search for Hook: locale
, then for Hook: init
. You will see that you need plugins_loaded
as parent action if you want to chain hooks.
Is it a good practice? It depends. If you need the second callback only when the first was running successful, then yes. If both callbacks should run independently of each other, then no.
Chaining should reflect the logic of your program.
Related Posts:
- How can I edit post data before it is saved?
- Edit plugin without hooks in functions.php
- How to list the Hooks and order of execution in current loading page? [duplicate]
- Pass A Value From Outside To A Plugin Variable
- How can I filter blog name?
- Determine plugin name from within plugin_action_links filter
- merging an array to an existing array using add_filter
- Get Time Taken By Each Action Hook in WordPress
- Redirect to another page using contact form 7? [closed]
- Add hook after content without formatting
- Customize plugin templates
- Display_rows() and column_cb() strange behaviour
- How wordpress plugin hooks works? [duplicate]
- How to Add Extra Text In WordPress Title Before Post Publish
- Passing a parameter to filter and action functions
- How to structure a plugin
- Get a list of all registered actions
- is_plugin_active function doesn’t exist
- Custom pages with plugin
- Where is the best place to use add_filter
- How to only hook on Single.php after content?
- WordPress Plugin Development In MVC Architecture, How?
- Is it a good idea to edit an already existing plugin to add more functionality?
- Checking if an attribute exists in a shortcode
- How To Determine If A Filter Is Called In A Sidebar/Widget Context?
- When can you get current page ID and initialize hooks right after?
- Show Similar Post Titles ( Similar to Stack Exchange )
- How do I unlock a post programmatically?
- Customizing subject in comment notification e-mails
- How to save the values of checkbox to the register setting?
- Create page when plugin is activated
- Using the ‘draft_to_publish’ hook (post status transition)
- Filter Hook on plugin update
- Using add_filter inside another class
- Enqueue style inside shortcode but its loaded at the bottom of page (before footer scripts)
- How can I limit functionality in one version of a plugin?
- Which functions in theme or plugin load first
- WordPress Plugin as ‘Library’ From Abstract Application?
- How to show custom message once on plugin activation?
- Add CSS animation as Preloader to WordPress
- Good tools for locating hooks in a wordpress page/admin interface/blog post?
- How to load a new template page according to a particular URL?
- Hide WordPress Plugin Deactivation Links
- WordPress network: set themes and plugins for new blog
- Updating post meta for custom post types
- Use external link in the add sub menu
- What are the benefit in adding hook in the init() hook?
- Reposition Woocommerce Message
- add_action in functions.php, do_action in plugin?
- Is there a way to alter the order in which the plugins appear in the page?
- How to correctly detect accessing wp-content/uploads?
- Custom plugins/Manipulated plugins: Always a terrible idea to inherit these types of WP sites that discourage updates? [closed]
- add action for displaying posts using a shortcode
- Randomize attachment IDs
- ‘wp_login’ action hook not working with wp-login.php file
- How to modify shortcode attributes with data from current post
- Pass info from functions.php to plugin
- Remove rewrite rules generated by plugin during deactivation
- Change permalink structure hidden button edit
- How to pull code snippet from functionality plugin?
- How to use get_theme_mod in gutenberg editor wordpress?
- Get IDs of Images from Gallery Block in InnerBlocks of a Custom Gutenberg Block
- WordPress plugin – Error “Plugin generate 2890 characters of unexpected output when activated”
- My plugin wants to update another plugin
- Where (or when) should I register a new taxonomy?
- How do action and filter hooks understand where to look for the core function that we hooked our function to them
- JS Support Ticket – Auto create WP account
- Any hook for pre-plugin-update -either bulk or single plugin update
- Input with spaces in Shortcode attributes overwritten by defaults
- Inserting above the comment template
- Creating a plugin to sanitize comment and the url field before display only
- Edit Yoast SEO breadcrumbs output [closed]
- How to find the origin of a file upload from within wp_handle_upload?
- How would I go about creating a user ranked post popularity page?
- How to get all of the activate_plugin action parameters?
- Modifying the comments section through a plugin regardless of theme
- How to stop activating a plugin and show admin notice when dependent plugins minimum version is not met
- Using a post-signup hook to get user details
- Disable woocommerce cookies and delete cart data automatically
- White page by using filter template_include
- How to fetch products with the price in a page on woocommerce using a form or live search with php
- How to check current user before all actions and filters?
- Create a navbar filter that filters by a custom field
- Passing an array from shortcode-function to filter-function
- custom payment gateway in woocommerce failed to connect to remote api server
- Best way to maintain and update 3rd-party WP plugin when developer is unresponsive?
- Are functions in main plugin file called before function bound to register_activation_hook runs?
- Filtering WooCommerce Orders by Category
- Best place for short bio,image and button [closed]
- qTranslate remove default directory from link
- Customization API for plugin development
- Fromcraft Plugin On click submit button [closed]
- do_action() hook into load-(page)
- Howto check version of another plugin and then add a submenu page to it
- How to redirect users to their profile after they successfully edit their profile
- How to change the name of the “edit my profile” link in the WordPress admin backend
- Proper way to replace the_content only for pages created by custom plugin
- add_filter doesn’t work
- Template filter for custom taxonomy terms
- Add sub menu page in your plugin