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?
- Not able to change wp_title using add_filter
- How to hook a filter to catch get_post_meta when alternate a custom field output?
- Changing JPEG compression depending on image size
- Advanced Custom Fields and Yoast SEO keyword analysis [closed]
- add_filter to youtube embeds?
- SSL certificate for the host could not be verified
- Store source permalink on XMLRPC calls
- How to limit the pages displayed for choosing parent page on page attribute’s menu?
- WordPress RSS feed – filter RSS content by custom field value
- What is the filter hook for custom fields content?
- Filter keywords from search query
- Add class to woocommerce checkout body based on filter [closed]
- Changing Gutenberg / WP block editor width only on pages, not posts or other taxonomies
- How to replace any occurence of Gravatars with a local placeholder image?
- How To Get User Data in Callback Function for pre_user_nicename?
- What’s the best way to split admin-only functionality in the theme’s functions.php file?
- Can I the caption shortcode to set caption to a data attribute, and with the image’s alignment intact?
- Which built-in WordPress files are safe to edit?
- How do I target a single page to modify the comment form of only that page?
- Contact Form 7 filter similar to preprocess_comment [closed]
- upload_files cap to not loggen in users – add_cap to not logged in users
- How to customize the “Insert/edit link” popup box?
- How do I override the_excerpt so that it will display full content?
- Get current user data
- How do I hook my function to run only after submitting login form
- How to write a filter to remove a form field (WordPress) [closed]
- Why doesn’t this function work when I know that the IP Address is “true”?
- Map plugin with proximity search compatible with Buddypress
- Create a pre-filtered version of the Media Library
- Removing URL and adding container around image in the featured image metabox
- How would I use a filter to remove header banner on certain post types
- What are the steps + prerequisites for using an add_filter?
- Filters on the_content with plugins, pages and shortcode
- Replace Data In Post & Update Meta Field Post Is Saved
- How to add custom media library mime icons?
- Customising the default wordpress search functionality
- get_post() with filters applied
- Ajax filter – show all results that contain at least one filter
- WP_Query filter by custom meta
- How to add a blog filter bar without paying money. (example inside)
- Override admin selected page layout
- WordPress: Issue with filtering users using date range
- Does anybody know what the $current_screen ->id for customizer.php is?
- wordpress filtering out caps in wp_title? (UpperCase is changed to Uppercase)
- shortcode which is introduced into entry the blog, and appears in side bar
- Is there a way to overwrite a filter used in canonical.php?
- Adding an orderby filter, casting postmeta with multiple keys
- post->post_content filter
- How to change this WP logo and posts url in block editor?