Unless a theme provides such a hook there is no way to do this with actions and filters. If a hook is provided then it will be theme specific, no generic WP solution exists.
For a full list of the hooks that a theme should implement, see here:
https://developer.wordpress.org/themes/advanced-topics/plugin-api-hooks/
At the moment this includes:
wp_head()
Goes at the end of the element of a theme’s header.php template file.wp_body_open()
Goes at the begining of the element of a theme’s header.php template file.wp_footer()
Goes in footer.php, just before the closing tagwp_meta()
Typically goes in the- Meta
comment_form()
Goes in comments.php directly before the file’s closing tag ()
section of a Theme’s menu or sidebar.
Note that aside from wp_head
and wp_footer
, there is no guarantee that the theme developer knew to add them, or did so correctly, particularly wp_body_open
and wp_meta
Related Posts:
- How can I see all the actions attached to an “add_action” hook?
- Which hook callback has priority if both plugin and theme use the same hook?
- add_action in functions.php, do_action in plugin?
- How to get menu location in wp_update_nav_menu hook
- Are there action hooks for comments?
- wp_login_form() ignoring login_form action hook
- Plugin Hook: Get posts
- Passing a parameter to filter and action functions
- Get a list of all registered actions
- When can you get current page ID and initialize hooks right after?
- Customizing subject in comment notification e-mails
- Check php version before theme activation
- What is the ‘admin_action_’ . $_REQUEST[‘action’] hook used for?
- WP showing “warning: call_user_func_array()”, What to do?
- WordPress admin notice in plugin function
- Using the ‘draft_to_publish’ hook (post status transition)
- How can I remove “Proudly powered by WordPress” from twentyeleven without modifying footer.php?
- Enqueue style inside shortcode but its loaded at the bottom of page (before footer scripts)
- WordPress Hook that will run when media file deleted
- Good tools for locating hooks in a wordpress page/admin interface/blog post?
- disable active plugins for specific theme
- Use external link in the add sub menu
- do_action and hook methods
- Is it possible to add an action to the currently running action?
- How to filter content post only on save
- Filter or action hook to insert content on admin pages before tag
- Is it possible to remove this action? (as it’s added just before it’s called)
- WordPress Plugin Boilerplate – add_action hook in static “activate” function
- template_redirect not being called when using ajax
- Uncaught Error: Call to undefined function get_user_by() after moving function from theme to plugin
- Can I use a method from an existing plugin as an action hook?
- Plugin custom Action Hook not working
- add_meta_box (Will display only in specific page admin WordPress)
- How to initialize something in unit test before the init hook being called?
- add action for displaying posts using a shortcode
- ‘wp_login’ action hook not working with wp-login.php file
- Prevent a plugin from being automatically activated
- How to Use Parameters with a Do_Action Function Within PHP Tags
- WordPress filter that hook after each action/filter hook
- How to stop or remove an action being called inside a function of an extended class
- Automatically add attributes to woocommerce product?
- Any hook for pre-plugin-update -either bulk or single plugin update
- wordpress plugin is not activating from widget
- Insert new user with form submit ‘init’ hook
- Calling plugin function inside custom plugin for onclick event
- Calculate price and display on woocommerce product single page under price (simple price, variable price) [closed]
- Are functions in main plugin file called before function bound to register_activation_hook runs?
- All sites themes functions.php have been changed
- How to get post ID with hooks publish_post, new_to_publish, etc
- edit_user_profile and show_user_profile are not firing inside a class
- the_post hook is not firing for me
- Create a post builder skin in a plugin
- remove_action not removing add_action from constructor
- Plugin Development – Functions or Hooks?
- How do I add some javascript validation to the admin interface form’s onsubmit?
- Basic function call on init failing
- how can I do something on new user registration?
- Hook for page Request?
- Use $variable from file1.php in file2.php (different file paths)
- How do I add $_SESSION[”] to my wordpress page?
- I receive taxonomy id
- WooCommerce: after install hook
- WordPress: Add custom add_filter for custom functions
- How to remove a class function from a plugin by using remove_action()?
- How to include files relative to a file’s directory
- How to remove products-links after the product title using remove_action
- speed up pagination for huge database
- Inserting Plugins Into Blank Space of Externally Designed WordPress Theme
- What hook can I use to modify custom post data before it is displayed on the page?
- Plugin Admin panel checkbox unchecked after submit
- uncaught TypeError: Cannot read properties of null (reading ‘classList’) custom plugin
- WordPress Cache delete on plugin uninstall
- Use a hook or filter, or overwrite this Gamipress function?
- Hook from plugin doesn’t fire up from external PHP script
- WordPress Custom Hook with Class method
- Replace old theme that understand old css (vcex_icon_box css_animation)
- update_option_{$option} not working (do function after options are saved)
- Callback hooked to post_updated firing on new posts as well
- The function called on the wp head hook becomes null
- How to get a post views count using ‘WordPress popular posts’ plugin
- front end editor creation for Restropress plug in – displaying information from a WP admin area, on a different URL
- Use action, filter, or hook to append HTML to WordPress plugin function
- Passing function into add_action always returns the first argument
- Get post content inside plugin class method
- Is it possible to disable a theme programmatically?
- Ajax call to php function doesn’t work PHP code
- How can I make the search bar in my wordpress site search all of the pages rather than just the blog posts?
- Creating Admin Submenu Page via Class Method
- I want add repository theme folder
- What is the correct entry point for capturing coverage data
- Run only on plug-in activation instead of wp_head
- Things that saved lose when logout
- plugins_loaded action is not working properly
- Woocommerce: deleted single-product.php, everything still works. How is it possible?
- change output location of plugin function using a custom hook
- Display static pages instead of category, in code
- How wordpress plugin hooks works? [duplicate]
- wordpress illegal string offset ‘parameter’ error
- Hook automatic_updates_complete to autoupdate plugin
- Real estate schema markup not showing up on Rich Results test