If I understand correctly,
wp_get_post_tags
returns the “post_tags”
taxonomy terms.
Yes, except that the taxonomy is post_tag
and not post_tags
.
How can I access “attachment_keywords” taxonomy terms?
wp_get_post_tags()
uses wp_get_post_terms()
, so you would do the same for custom taxonomies.
For example if the taxonomy (name/slug) is attachment_keywords
, then:
$tags = wp_get_post_terms( $post->ID, 'attachment_keywords' );
And that should work, but as suggested in the documentation for wp_get_object_terms()
that’s used by wp_get_post_terms()
, you might want to use get_the_terms()
instead which caches the results and thus can help improve performance, specifically when looping over posts results.
Related Posts:
- Remove tag on my RSS Feed
- get_the_excerpt() not returning anything when post has no excerpt
- Automatically add author’s name to post_tag
- Adding a class to tag list in a function
- Create single.php for specific tag by tag id or name
- list tags with count in author profile page
- Product Tags in Add New product as checkbox list [closed]
- Retrieve tags data in post body
- Echo tags used to describe the theme
- Frontend tag edit/submit form
- Is possible add icon in title posts only in specific tag?
- Display tags that only appear in one category
- Add a unique class to HTML tag/element
- How to edit the Tags within the image file URLs?
- Function filter breaking tag archive menus
- Tags break custom Excerpt function
- Numbering lines of code with the tag?
- Randomizing wp_tag_cloud() in child theme
- Sort and display pages with specific custom field (not tag)
- Function to echo (or display?) wordpress tags in the head section
- Allow user only create specific tags
- Removing sanitize_title_with_dashes Function with The Real Title
- method to fetch entire tag list on archive.php
- require_once() Causing categories and tag pages on dashboard to not refrsh
- Change post count on tag/terms pages to 10
- Custom taxonomy not refreshing page on add
- Automatically add tag if a checkbox is checked
- getExcerpt: Make ellipsis appear only if character limit is reached
- Make WordPress search for only this tags or exclude certain tags from search [duplicate]
- How to get tags and categories?
- If two tags in the middle i need comma
- Display function from functions.php in tag.php
- Bulk set Post Title as Tag where Tag is Empty Function
- Does hooking into the same action multiple times drain memory?
- Different wp_mail_from and wp_mail_from_name for specific situations
- register_post_type for Pages?
- is_front_page not working in functions.php
- VERY new to coding – keep breaking site trying to add to functions.php
- Restrict user registration to emails on a single domain
- Call to undefined add_action() in theme’s functions.php
- How to enqueue JavaScript for specific WordPress pages only?
- Passing HTML in WordPress Shortcode arguments
- Can I use require() function in a template file?
- What is the most efficient method for loading widgets in functions.php
- Enqueue script o style only if a template part is loaded
- Exclude Empty Child Categories in Menu
- Can I pass two roles to the function get_users?
- Convert User ID’s to User Names in a single.php file
- How to specify which Gutenberg blocks are available in the editor for a page template
- password protected post policy
- Custom Shortcode, functions PHP WP_Query loop
- wpautop – disable tags, keep tags
- Logout hyperlink within a sub-menu
- How do I pass arguments for multiple functions hooked to a single action?
- Manipulate Permalink
- Change the HTML of the comment form that is generating somewhere from the core WordPress
- Theme functions.php file auto delete everyday [closed]
- How to get the index number of the posts?
- Two Types of settings in WP – The Doubt
- Custom Attachment Caption Fields
- How to call particular funcion when the check box is checked in plugin options page
- Call WordPress function outside of WordPress
- Events: Check for other event with same start date and category [closed]
- enqueue_script with filemtime javascript not working
- WP function won’t work on 404 template page
- Can we create our own theme’s function.php?
- Not all CSS elements transferring via parent to child?
- How to append classname to body tag if guest user
- add_filter to specific WooCommerce Category
- Need To Change WordPress Meta Tags… Includes wordpress shortcodes
- Adding a section in line at the end of the main navigation menu in php
- Only echo Page Content (not page title & page content together)
- update_post_meta is Updating with two page id
- How do I preserve changes to a theme’s functions.php across updates?
- sort metabox columns in listing Single
- Fetch URL parameter
- Updating custom query var with multiple values
- WordPress wp_dequeue_script remove all other scripts
- How to use WP conditional tag in a functions.php with OCEANWP Theme?
- How Can I Create a Friendly Slug for a Dynamic Page?
- function class doesnt work
- Load CSS file conditionally
- my wordpress doesn’t save items to customized widget area
- save_post doesn’t correctly process function call with php class
- Newest comments first not working
- Pass arguments to function class with do_action()
- How to a override parent theme page that has been included with require_once?
- Display most popular posts
- Excerpt length: get 2 paragraphs
- Remove heading tags on line break
- Add custom fields after post/page title
- Ajax call does not work for this custom code
- Force resize for all video content
- Sort results by name & asc order on homepage
- Add the title of a widget as an ID – for anchor links
- I want to add the alt attribute to all the photos!
- Creating mixture of shortcodes to use in the visual/text editor
- Correct php syntax to add an image in wp functions.php
- Is storing in a variable the result of a fonction a most powerful way to code an if structures in WordPress?
- Add functionality to block comment authors in the Comment edit pag