It should be possible but you will have to be aware of timing issues. Your shortcode will have to execute before whatever hook you are hooking into.
That is, you can’t hook into wp_enqueue_scripts or wp_head but you should be able to hook into later hooks like wp_footer. I suspect that timing is the problem.
Related Posts:
- apply_filters(‘the_content’, $content) vs do_shortcode($content)
- How to get shortcode’s input values inside a filter?
- Filter specific shortcode output?
- Insert Custom HTML After Shortcode
- Is there a way to add another row to the tinyMCE kitchen sink toggle?
- add_filter and changing output captions of image gallery
- How to add attribute to output with wp_video_shortcode add_filter
- Search content for shortcodes and get parameters
- Change default settings used by gallery shortcode
- Shortcodes not resolved in AJAX call response
- Ajax, filters and shortcodes
- Format content value from DB outside of WordPress filters
- Use content custom filter for all shortcodes
- How to link current user to their author page through shortcodes
- filter title from shortcode
- how to remove filter from wordpress shortcode output
- Error when overriding only some audio shortcode HTML output
- How to use shortcode attribute in separate function
- Shortcodes — Using add_action, add_filter in the shortcode
- How to pass variables to custom filter from multiple functions
- How to filter backend post list showing only posts having a shortcode
- How can I return shortcode output to the top of the content?
- the_excerpt filter doesn’t work as expected
- run shortcode in excerpt of single custom post type
- Filter everything from content except output of a shortcode
- Something is filtering my shortcodes… Can’t figure out what
- How to use do_shortcode_tag to modify the output of a shortcode?
- Shortcodes within the sidebar text/html widget: How to preserve the raw HTML output of the shortcode?
- How to change dynamically page title according to variable data?
- How can I filter tag_description()?
- WordPress removing slashes from shortcode output
- How to remove shortcode(s) from WYSIWYG Page editor for Non Admins
- Shortcode / plugin with custom (flexible) output
- Filter Shortcodes when using get_page
- Parse a shortcode differently based on on what it’s nested in
- Need to return shortcode text instead of the output
- add_filter to the_content after apply_filters
- post_orderby filter breaks function
- the_content getting current page content instead specified ID
- Override wordpress audio playlist
- How to wrap pattern-matches from the_content in [wiki]-shortcode tags
- Add Index to Item in WordPress Gallery
- create a shortcode with acf including a filter
- How to take shortcode and content separately from a page?
- Auto-generated excerpt with shortcode and read more button/text link
- shortcode function outputs multiple anchor tags
- apply_filters to $GLOBALS
- Change shortcode output (filter?)
- Activate short codes for all post queries?
- Problem with shortcodes in external file
- How can I display wp_link_pages before a shortcode, if it is used, or display after content?
- Passing Additional Parameters to add_filter Callable
- How can I add an Author filter to the Media Library?
- Modify WordPress Rest Api Request/Response
- How to add some custom HTML into wordpress admin bar?
- Add wrapper to only youtube videos via embed_oembed_html filter function
- Hook into admin post list page
- Add post/page ID to inserted links within the_content
- Possible to filter the posts or categories that XML-RPC users see in their mobile application?
- wp_link_pages output appears twice
- Multiple Ajax Data Action
- Changing a WordPress core function without hacking core
- Change WordPress RSS link with filter?
- How to remove get_post_metadata using remove_filter inside a class?
- Sorting and limitation with pre_get_posts
- Warning: Missing argument 2 for widget_title filter
- Change term name only on front
- How do I hide the current page’s title?
- Change name of existing post status type
- Header image automatically changes depending on season
- How to hide Ads in between posts on AMP? [closed]
- What is the downside of using a filter as a “poor man’s” dependency injection?
- BBPress changing default group activity
- Get Posts updated or published within the last x hours
- preview_post_link for Custom Post Types
- Filter an array with a callback – for single & multidimensional arrays
- Are href attributes of a elements filtered on output to add the current path?
- Add Filter not working with get_posts
- How to Prevent WordPress to encode html in post?
- Why template_include filter does not work with WPML plugin?
- Most performant/functional way to add actions/filters?
- Modify a plugin function output from another plugin
- Making an add_filter() call from within an add_filter() call
- Action hook to control access to certain parts of my site
- Finding actual functions added to hooks and filters
- Use alternative front page if cookie is set
- Setting the page title in a plugin, but not outside my plugin
- I want to hide “sold by” on certain pages with id page 43
- how to output HTML tags in post_content and not as plain text
- Security question – Display a General Custom Login Error Message
- How to apply a filter to everything?
- Shortcode to eliminate and replace with
- WP Job Manager – display search results from custom search form in taxonomy-job_listing_category page
- Conditionally (cpt) filter previous and next_post_link
- changing size image within the content
- apply_filters to content but ignore shortcodes
- get_the_excerpt on mobile still displays continue reading
- Filter and Search
- How to use filter in this situation, can not modify the structure using filter
- Woocommerce price filter widget always shows max price of most expensive product in the whole shop