Use both hooks, and call did_action to find out if the template hook fired or not.
https://developer.wordpress.org/reference/functions/did_action/
did_action will return the number of times a hook/action has fired. With this you can return early in the footer action
Related Posts:
- Load different template file when condition met?
- Would like to use hook or filters to customize email templates
- How to pass/get data to/from the WooCommerce data-product_variations object?
- Passing Additional Parameters to add_filter Callable
- Modify WordPress Rest Api Request/Response
- How to add some custom HTML into wordpress admin bar?
- Custom theme hooks / filters – passing arguments
- How to hook wp_list_pages?
- How to make post and comment count unclickable with dashboard_glance_items hook
- How to use the_excerpt in a filter hook?
- Hook into admin post list page
- How to limit the pages displayed for choosing parent page on page attribute’s menu?
- How can I hide all posts that don’t have a thumbnail?
- How can I reliably and globally disable wptexturize?
- Customise Jetpack Publicize text
- WordPress RSS feed – filter RSS content by custom field value
- How to get list of all hooks of current theme / plugin?
- What hook/filter can I use to add/edit/show/hide the title under (on hover) links on the table view?
- Change WordPress RSS link with filter?
- Add a header before fields added with the attachment_fields_to_edit() filter
- Hide content editor for posts after approriate date
- Why my admin doesn’t work after adding rest_prepare_post filter?
- add_filter() function misunderstanding
- Same Conditionals Not Working on Two Different Hooks
- Filter or Hook to catch pre-rendering of post content
- Can the wp_filter object hold multiple values with the same key
- check to see if hook is available
- apply_filters/do_action tag characters limit
- Modify a function without editing template
- Insert term when page is published – avoid duplicates after edits
- How to modify core when there is no hook?
- When does a function assigned to the content_filtered_edit_pre filter hook fire?
- Capture post content before page renders
- Remove_action does not work
- How to remove action with slashes and arrows?
- Better extend a class or use add filter/action hooks?
- Add content as soon starts
- Make an array filterable per hook
- Changing WordPress core without hacking core
- Comment search plugin
- Plugin options, presets and filters : can you help me improve my workflow?
- how to customize rss feed tags using hooks?
- What hooks to hook onto for automatic cache clearing
- Modify Redux Framework Options in Child Theme
- Adding a filter to comments_template
- How to customize category_description()?
- How can I output all apply_filters and do_action?
- Set default value for “Additional CSS class(es)” for specific block types
- Disadvantage of using filters & hooks multiple times
- How do I hook my function to run only after submitting login form
- Admin post list – adding an option to the date filter dropdown
- Modify message displayed on post save
- How to add a filter to the get_body_class function?
- Prepending character(s) to a custom tag title?
- Pass debug_backtrace() in WordPress filter
- How to override include_once pointed file using add_filter?
- Remove actions/filters that are set with create_function()
- Get The Caller (Plugin / Theme / Core) For All actions & Hook in WordPress
- comment_for() Custom fields not visible when user is logged in
- How to access page variable inside action hook
- What is the action hook to use if you want to capture the new password during password change?
- I need to hook and change language of facebook sdk
- Use has_filter on comment_post
- Renaming wordpress login and get new password button
- Is this hook really deprecated? ( manage_{$taxonomy}_custom_column )
- Hook in a sidebar widget and add some markup
- Shortcode / plugin with custom (flexible) output
- Need to return shortcode text instead of the output
- output custom Posts on a Page
- BuddyPress – A hook available to hide custom born date on public profile view?
- How to redirect template_directory to subdomain relativ url?
- Replace Data In Post & Update Meta Field Post Is Saved
- ‘manage_users_custom_column’ is a filter, but ‘manage_posts_custom_column’ is an action. Why?
- Scanning for custom embed and prefetching
- The gettext hook doesnt work on text with links
- How to add custom media library mime icons?
- Remove and replace woocommerce add to cart button [closed]
- Hook to change the site URL
- Modify WordPress Page Title ()
- Add an attribute to the root from functions.php with add_filter
- Hook to add content after date in post?
- Is it possible to assign a css id to a row in plugins list table?
- Add Index to Item in WordPress Gallery
- Remove image of srcset
- Re-order search results with posts_orderby filter and post meta value
- Incrementing content with extra text after save/publish
- wp_editor customization
- Converting restricted html in comments to bbcode
- How to add a class to Buddypress avatars in the Activity stream? [closed]
- WooCommerce comments_template Filter Not Firing
- if i put the code in my theme’s function.php file can it work?
- Admin New Order: Autofocus on Search a product
- NextGEN Gallery: Adding drop-down menu widget to gallery view without modifying plugin code [closed]
- How to filter part of a variable if it is no array?
- str_replace css meta tag?
- How do you disable the verification process of user email changes?
- Can you call a filter hook by “add_action”?
- How to elect position of new item output in a dropdown when using add_filter
- How to Dynamically Switch WordPress Front Page Without Causing Canonical Redirect?
- “Invalid parameter(s): attributes” issue in context of “blocks.registerBlockType” filter