register_taxonomy_for_object_type()
will do what you want as long as the taxonomy and object (post_type
) are already registered elsewhere. Very useful when dealing with a plugin’s CPTs you need to add a taxonomy to.
add_action( 'init', 'add_tag_tax_to_posts');
function add_tag_tax_to_posts(){
register_taxonomy_for_object_type( 'SLUG_OF_PLUGIN_TAG_TAX_HERE', 'post' );
}
Or to do the reverse, and add the default tags (post_tag
) to the CPTs:
register_taxonomy_for_object_type( 'post_tag', 'SLUG_OF_PLUGIN_CPT_HERE' );
Related Posts:
- How to debug a plugin with Xdebug?
- function deactivate_plugins does not exist
- what’s the meaning of the field wp_capabilities in table wp_usermeta
- Is there widely accepted phpDoc syntax for documenting which hook calls a function?
- Make Categories and Tags required in admin
- Getting wrong relationship value in $args in wp_Query?
- wp_schedule_event in a class
- custom XMLRPC method plus authentication of user & WooCommerce order
- How to extend LINK TO functionality in ATTACHMENT DISPLAY SETTINGS
- How do I Make a Theme “plugin-ready”?
- How to iterate through custom posts and add the title to an array
- WordPress Terminology Options Vs. Settings
- How to Structure a New Role/Capability Scheme?
- How to create Image gallery Metabox in wordpress [closed]
- Display only certain posts based on visitor’s country?
- Is it possible to create an action hook using do_action() within add_action()?
- Custom user profile, registration, login page with theme
- Plugin Sidebar is not Saving Meta Attribute to Post/Page after “Update”
- Possible to preset a widget’s contents via a plugin script?
- WordPress 2.8 Widget API is suitable for Worpress 3.1.4 plugins development?
- Need specific kind of “Poll Voting” for WordPress [closed]
- Install widget on plugin activation
- Plugin admin page meta_box toggle and order state not saving
- Is there a better way to implement responsive images than what WordPress uses by default?
- Generate dynamic page through data from another page
- Does WordPress’s HTTP API use any caching?
- query users by role
- call_user_func_array() expects parameter 1 to be a valid callback, array must have exactly two members
- How to Create Custom HTML Tag on Editor in `Text(HTML)` mode
- null callback in add_settings_section
- Comments do not respect display_name setting, how to make plugin to overcome this
- Is there a Filter that I can use to filter the tags before they are inserted in to the database?
- How long should it take for a plugin to fully load into the WordPress.org plugin repository?
- Which directory in my plugin repo does WordPress Plugin Directory package?
- How can I pass get_the_author_meta(‘user_email’) through the REST API?
- get post attachment using ajax
- Replace default Blogroll Links with Social Media Links
- How would you compose a complex plugin with lots of routes and functions? [closed]
- How to enqueue or include json file to a plugin
- Search and Filter
- Show error, when selecting image in WordPress media uploader if params mismatch
- Trying to code a simple plugin, infinite loop?
- Update own Plugin Repository on Multisite
- Custom Plugin theme filter
- How to exit a plugin’s execution mid-stream?
- Issue with contextual help overwriting existing content
- Inserting code to HTML view from a pop up initiated from visual view
- CSS not affecting widget output
- Redeclaring a plugin function within a class
- Using a custom shortcode from within the template of a shortcode plugin
- What plugin development paradigm differences have occurred between version 3.5 and now?
- enqueue script/style plungin development
- Trying to get class to instantiate ONCE (or, “why do I keep punching myself in the head?”)
- How to create a WordPress Plugin that has it’s own “page”?
- Error: Call to a member function get_error_code() on a non-object
- How to Add a Custom Size for Thumbnails for WP – Gallery
- Create Widget or Enable Shortcodes in Sidebar
- How to get custom post_author?
- Will I get an error if I try unscheduling a WP Cron scheduled task that wasn’t scheduled?
- Conditional Generation of Image Sizes using add_image_size
- Plugins and caching
- Display time difference (6 hours ago) in a Soliloquy caption
- Empty Array is Giving Warning for array_merge()
- how to create category with code in wordpress using form
- Is it possible to have instead mypage.com/?page_id=81 to have mypage.com/cool/?
- User Data Handling between two plugins
- wp.media Uncaught TypeError: Cannot read properties of undefined (reading ‘state’)
- Pass custom props to
- Translations only load from `wp-content/languages/plugins` but not from the plugin’s languages folder
- Woocommerce place order update shipping price
- GET request return value as error instead of success
- How to update global variables in plugin activation callback?
- How to include a page template and template part into my plugin
- WP_Fatal_Error_Handler OR WP_Error OR try/catch
- Why does do_action pass a blank string as the first parameter if no $arg is set?
- ajax response strips multidimensional array and unable to decode
- Multiple instances of $opt_name in redux framework
- Using AJAX to submit and return data inside the WordPress Plugin Boiler Plate framework
- The Events Calendar featured image as body background?
- Pass javascript result to shortcode executer function
- How to affect front page by plugin
- Not able to Update database while creating a custom module
- Plugins and how to assign urls to content
- How to make auto installer Plugin?
- What method should I use to store my plugin data (multi level menus with options on each item)
- problem with blank page
- Getting error of unexpected output during activation
- Use custom clean URLs for a plug in
- Cannot echo a JS variable to a jQuery plugin coming from wp_localize_script
- Select options not reloading after form submit
- first_name property missing inside register_user action hook
- Pass results of custom query to loop – when writing a plugin
- Plugin SVN folder structure
- How do I use (or mimic) document.getElementById() on a page loaded from WordPress database?
- how many rupee or dollar charge to client to make theme [closed]
- user can login from single account detail from multiple locations(computer) at the same time [closed]
- Find Any Theme’s page.php File
- WP Job Manager – Show recent jobs as cards
- Admin Menu for New Post
- multiple record insert creating many duplicate records