actions do not “return” values. If you need to do some heavy computation that you want to avoid redoing at a later stage then you should store the value at a global variable (pure global, static or a field in an object depending on your favorite coding style).
Related Posts:
- Validate form in functions.php, send errors back to template
- add_action init breaks site on PHP 7.1
- remove an action hook function on a plugin from a theme
- remove_action or remove_filter with external classes?
- Why does save_post action fire when creating a new post?
- How to know what priority to use with add_action()?
- Can my “add_action” function know the name of the hook calling it?
- Can an action callback prevent the parent from continuing execution?
- remove_action in a theme
- add_action ‘manage_posts_custom_column’ in a class [closed]
- Cron jobs in a class
- Add something to beginning of the content
- When and Where to use wp_insert_post()
- How to use conditional add_action for WordPress
- wp_logout action not working
- add action which returns modified value
- What would cause the ‘wp’ action to fire twice per page (but only once per post) in Firefox only?
- I don’t understand why I need a lower priority to remove an action with a higher priority to make it work
- Manually add admin bar
- Is there a way to expose additional fields to the Bulk Action > Edit functionality?
- do_action pass array argument as reference not copy [duplicate]
- add_action and wp_head not display content in head section
- Scheduled event won’t fire
- When should I call add_settings_section and add_settings_field?
- WordPress Plugin Boilerplate – add_action hook in static “activate” function
- Usage of do_action and add_adction
- What is the best filter where to use register_block_type?
- WP action is not triggering a do_action() call within?
- Mustn’t do_action be accompanied with a function?
- How to set a different value in the generator meta tag?
- remove_action returns FALSE
- Remove action from shortcode
- Write automatic title at save_post (infinite loop)
- How to get $tag to fill into add_action() or add_filter()?
- Add meta field after post has been published
- Using several add_action with parameters inside a class
- Action hook for editing post
- remove_action returns false regardless of priority
- Is there way to run a code every time when any cron is run?
- How to make an action run in the background?
- Remove Action from Plugin within extended class and no assigned variable
- Action when sidebars updated
- Payment before publishing post
- Why does my wp_safe_redirect output the ERR_TOO_MANY_REDIRECTS error?
- Add a filter inside an action init
- How to access author data from header action
- Content won’t load when using action the_content
- How can I unhook this action that was added via $this?
- add_action on a specific page
- Update media library image shown in “attachment details” when using wp_insert_attachment to add item to the media library
- How to find where an action is triggered? [closed]
- Create post revision on slug change
- Is dynamic action name building a bad practice?
- Form action unfamiliar
- Why does my delete_post hook get called twice
- Basic function call on init failing
- Which hook to add action on specific page?
- A unique wp_schedule_single_event() for each post?
- problem loading stylesheets to wp_head dynamically
- Action Scheduler not running
- add_action(‘init’) not work
- Adding php to form action breaks code [closed]
- call custom action after delete account
- Is this the correct way to enqueue style sheets from parent theme and then from child theme in wordpress?
- Dynamic name of cron event
- Dynamically adding filters
- add_action to wp_head is added, but not called
- Activity feed on admin dashboard
- update_user_meta not updating
- How do i know which action / filters are called when i call get_option()
- action wp_set_comment_status never gets fired when i change the comment status [closed]
- Session management issues with WordPRess 404 Error page
- Using get_terms for custom taxonomy in functions.php
- RTrouble passing arguments to action
- Change or rewrite add to cart button functionality “
- Better use two dedicated methods hooked with add_action() to different actions, or can it be twice the same method?
- admin_notices is not working inside function
- do_action doesn’t trigger if it’s in a template that gets loaded via REST endpoint
- Best hook for when a user session ends?
- Passing function into add_action always returns the first argument
- add_action where function has arguments
- Load actions and filters only for the admin CPT list
- How to override parent theme actions
- Add Action wp_update_post not Updating WYSWIAG editor
- adding an action inside if condition not working
- remove action from woocommerce file
- Can I run a slow action in a seperate thread?
- Font Awesome not loaded on first page of website only – divi theme
- WP_LIST_TABLE bulk action
- Dealing with html forms [closed]
- Cannot Schedule Sending An Email
- OOP – add_action
- do_action in header, add action later?
- Add-action in function
- save post running twice and creating two database entries – how do I disable this?
- Plugin that generates a page of post content
- Using add action for class with construct
- add variable to actions/functions across different files (woocommerce)
- Webhook: save_post action fires wp_remote_post twice
- A way to see real changes of posts inside an action?