First, register the filter hooks with the handy apply_filters tool:
function wpse_238394_org_types() {
return apply_filters(
"my_org_types",
array( "affiliate", "direct", "bureau" )
);
}
Now, wpse_238394_org_types() will return the default 3 types being not filtered yet, so we one more custom type:
add_filter("my_org_types", function($types) {
$types[] = "custom_type";
return $types;
});
Now if you debug wpse_238394_org_types() it should be including the custom_type item along the defaults.
Hope that helps. Please also take a look at the docs https://developer.wordpress.org/plugins/hooks/creating-custom-hooks/ as jdm2112 suggested.
Related Posts:
- Passing a parameter to filter and action functions
- Get a list of all registered actions
- How can I edit post data before it is saved?
- Registering Class methods as hook callbacks
- How to customize woocommerce related products? [closed]
- Why does wp_enqueue_style() in plugin not load stylesheet?
- Customizing subject in comment notification e-mails
- Edit plugin without hooks in functions.php
- How can I log a user out of WordPress before the page loads?
- WP showing “warning: call_user_func_array()”, What to do?
- Modify featured image URL at runtime
- Seeking clarification on page request life-cycle
- Which hook should be used to validate custom form fields on the login form?
- Hook (upgrader_process_complete) running moment
- Pass A Value From Outside To A Plugin Variable
- Built in admin ajax hooks?
- Adding dynamic section to WordPress
- woocommerce product attributes
- How to filter content post only on save
- Filter or action hook to insert content on admin pages before tag
- plugin_action_links_{$plugin_file} hook not in the main plugin file
- How to find out what blocks are added by a plugin
- merging an array to an existing array using add_filter
- template_redirect not being called when using ajax
- what the hook for displaying course list page for learndash plugin? [closed]
- How to add rewrite rules and pagination to retrieve attachments files?
- Plugin custom Action Hook not working
- What are the benefit in adding hook in the init() hook?
- What are ideal hooks to call register_sidebars?
- AddFilter option_active_plugins is executed 6 times. Why?
- Hook to generate a dynamic sitemap with “All in One SEO Pack” Plugin
- How to correctly detect accessing wp-content/uploads?
- Deactivate Plugin on Theme Switch
- Where to hook my plugin’s action
- How to pull code snippet from functionality plugin?
- How do action and filter hooks understand where to look for the core function that we hooked our function to them
- Add custom message to the plugins page of WordPress
- Hooking in to replace the Sidebar/Widget areas
- How to get all of the activate_plugin action parameters?
- Using a post-signup hook to get user details
- woocommerce_package_rates not fired when wordpress woocommerce accessed as non ajax
- Trigger Elementor Popup via code [closed]
- Filtering WooCommerce Orders by Category
- do_action() hook into load-(page)
- Howto check version of another plugin and then add a submenu page to it
- Why do plugins often ask to add in to templates?
- remove_action not removing add_action from constructor
- How to get menu location in wp_update_nav_menu hook
- Flipping Book PHP Code? Any experience?
- Turning on output buffering in a wordpress plugin
- Display Plugin Panels Outside of Admin Areas
- How to use template_include hook with form submission?
- Save user total active time after login in wordpress [closed]
- Advanced WordPress plugin activation detection
- wp_loaded with static Singleton
- wp_trash_post hook – problem with page updating if using wp_die
- How to return the values from a row where a value occurs for the first time among the rows available?
- is it possible to hook every page style?
- Add action to custom Function
- How to hook into action/filter call
- How to automatically activate users after registration without activation email?
- Hooks to run after a core upgrade?
- Plugin Hook When New Author Added
- Adding custom Field To The Posts Listing
- Add hook after content without formatting
- Using Remove Action Hook in Plugin
- Fail on admin_enqueue_scripts when I try it to upload a CSS file to my WordPress Plugin
- admin_post hook not firing function inside class
- Alternative Hook to the_content for Changing Background Color
- Unpublished Pages Failing To Appear On Custom Path
- Hooking into the HTML header container
- Hide WordPress Site URL from Source Code
- Plugin function in child theme
- Edit plugin’s HTML output with Hooks
- Display Woocommerce attribute name above product title
- {status}_{post_type} does not run correctly?
- WordPress Boilerplate Plugin doesn’t see callback functions for add_settings_field and add_settings_section
- What is the correct entry point for capturing coverage data
- Identify if the_post hook is being called from the admin post list
- Why can’t I shove an instance of a class into a variable from a do_action hook?
- Add a filter to a method in the parent theme
- Publish check if the edited content has HTML “div”
- Passing a parameter to filter and action functions
- Run only on plug-in activation instead of wp_head
- WordPress hook source
- How to `remove_action` from plugin
- Plugin Hook: Get posts
- Transition Post status not working
- functions.php conditional output for a single plugin
- How to make plugin work in each template in wordpress
- OOP Plugin: Where should I place the action hooks in the class?
- add query string to all pages after user logged in
- Order shipped by which driver[hook for woocoomerce order staus changed and popup in admin panel ] [closed]
- Hook automatic_updates_complete to autoupdate plugin
- Can’t use updated variables in handle function
- Neither update_option nor delete_option fires in deactivation hook
- WordPress : how to create onglet and remove it when only one
- I have to select text from gutenberg editor. Purpose is to store and replace text
- Similar hook to ‘init’ for when plugin page loads
- Which approach for managing automatic updates would be more robust?