add_action()
uses add_filter()
behind the hood.
function add_action( $hook_name, $callback, $priority = 10, $accepted_args = 1 ) {
return add_filter( $hook_name, $callback, $priority, $accepted_args );
}
Source: https://developer.wordpress.org/reference/functions/add_action/
So basically it doesn’t matter if you use add_filter or add_action.
But it doesn’t mean you should, using the appropriate function for a event will make your code easier to follow and understand, if you always use add_filter or add_action for every single event it can create a lot of confusion.
Related Posts:
- Is the codex no longer actively maintained?
- Add Option if Not Exists
- Why is the use of @uses tag in docblocks discouraged?
- What does the raw value for the get_bloginfo’s filter argument exactly do?
- WordPress Codex has different number of arguments for get_previous_post and get_next_post functions. Why?
- WordPress Codex or equivlent for Kindle use?
- Difference between `is_serialized_string` and `is_serialized`
- Wp Super Cache – Function to reset cache of a specific page
- What is the significance of _e(“Some String”, ‘String’)?
- Using Json Schema with wordpress codex
- adding category and tags to admin plugins menu
- How to disable Wp-Page Navigation on Blank Search in WordPress
- Cleanup orphaned wp_terms and wp_term_taxonomy
- Where to find new class reference or function of deprecated one?
- how do i add customizer edit option without plugin in wp
- Next/Previous Url only
- What is the reason to use function strings for callbacks
- Is there a flowchart for WordPress loading sequence?
- numberposts? showposts? posts_per_page?
- Upload Multiple Files With media_handle_upload
- Alternative to query_posts for main loop? [duplicate]
- Is There a Plugin Life Cycle Documentation?
- What does is_page_template() compare against?
- Issues enqueueing parent & child theme stylesheets with revised Codex method
- Different number of posts in each category
- Authoritative answer on which boots first – Plugins or Themes?
- Which action to hook wp_enqueue_script to? wp_head or wp_enqueue_scripts? [duplicate]
- How can i list current author’s categories?
- How to copy an existing (custom themed) site to a new domain
- How can I do customizations on login, registration and password recovery forms?
- wp_get_attachment_image_src always returns false
- Whats the difference between blog_info(‘stylesheet_url’) difference get_stylesheet_uri()
- WordPress codex: apply_filters – clarification on creating a new hook on the fly. How do we use it?
- get_current_site() not returning site name
- Why does WP recommend against custom favicon functionality in themes?
- Are we allowed to use the Allman (BSD) indent style when coding WordPress plugins and themes?
- Override Constants in Child theme
- Browser title script ignoring is_page /else conditional [closed]
- Calling a plugin in theme development
- Changing next and previous post link text
- Does codex.wordpress.org use a plugin of some sort? If so what plugin?
- When to use an if statement after get_posts?
- Logic to Print/echo a css class only for 1st post and ignore all post after 1st? [closed]
- Programatically added attribute, set to ‘show on product page’ automatically. Woocommerce [closed]
- Where is the changelog for 3.5? where is the list of added removed files?
- Get the category name outside of the loop in category.php
- I want to remove the home page header image from all other pages
- download_url() appears as grey icons
- How to use WP_Term with (menu) argument in the wp_nav_menu?
- How to use Internationalized human_time_diff() function in Chinese?
- Is the ‘/category/post-name-date/’ permalink structure okay?
- Help with WordPress Query
- How to slice an array using posts_per_page? [closed]
- WordPress is adding margins and padding to my custom menu?
- How to add a zero before numbers in WordPress Post Pagination?
- $reverse_top_level works the opposite way according to Codex?
- Multiple Images/ Slider with custom post [single.php] [closed]
- Set $options reference
- WordPress from url get external source title
- Codex Version Focus on Production or Nightly?
- Breadcrumbs – get the author?
- the_tags : can we insert a class
- WP_Query for custom post type and category_id not working
- REQUIRED: get_bloginfo(‘template_url’) was found in the file search.php. Use get_template_directory_uri() instead
- get_month_link uses what wordpress template?
- post_class not working with css
- Do I need to include a textdomain if my theme doesn’t support translation?
- Enqueueing Scripts/Styles mid-page
- What are these undocumented arguments for register_taxonomy?
- How do I define and register a shortcode function in a namespaced functions.php file?
- using add_action without having custom plugin or theme
- Block wordpress style for my plugin admin page
- get current page number with wp_link_pages()
- WP Codex answer incomplete? Put WP in subdirectory. .htaccess change required
- use custom field value as post category in loop
- What are the available options for “Name” in WP search?
- Excluding category from post navigation in WordPress?
- Function for when new custom post type is created should do something
- Remove Theme menu link from Admin Panel
- Re-coding category-template.php to go to custom URL
- Remove Url Parameter WordPress
- wp_schedule_event need to deactivate plugin changing recurrance
- Can’t put a hyperlink on Featured Post’s Image
- Rewriting to a different page based on existence of query string?
- Does a codex exist for creating meta boxes in taxonomy
- Questions on WordPress Codex Concept
- How to change templates based on URL
- Redirect users not logged in to the standard login page (and back) from some posts and pages
- Misleading information in the Codex, how do they get away with it? [closed]
- get_page_by_title() doesn’t return the post object if the title has inverted comma (‘)
- Get comment number by date range?
- if is specific custom post in cpt
- How to use filter in this situation, can not modify the structure using filter