This does a query for all posts of type family guy, tosses them into the $fg_obj
then loops through each post, grabs its tags, and creates a flat array of just the tag name. Then that array gets put into a new array with the post ID. This seems like a strange way of getting this info (because I don’t know the final purpose of this array), but it should be the format you’ve requested.
$args = array( 'post_type' => 'family_guy', 'posts_per_page' => -1 );
$fg_obj = get_posts($args);
$posts_with_tags = array();
foreach($fg_obj as $fg) {
$tags = get_the_tags($fg->ID);
$tag_arr = array();
foreach($tags as $tag) $tag_arr[] = $tag->name;
$posts_with_tags[$fg->ID] = $tag_arr;
}
Related Posts:
- Load custom posts with same tag as page
- How to display Custom Post Type Post based on Tag with Shortcode Parameter?
- Custom Tag Description unable to display just below and outside of the Loop
- add custom tags for custom post type in wordpress
- Custom post tag images not displaying with ACF
- WordPress Custom Post Type and sort by Tags
- Query Custom Post Type by Tag
- post_tag taxonomy with custom post type
- How do I programmatically add items of content to a custom post type?
- Ajax filter with custom taxonomies
- List events by month
- Custom post type loops with different page templates
- How can I programmatically save data into custom fields that contain serialized data?
- Categories and Tags not working!
- Row actions not showing? Why?
- Displaying custom post type on front page
- Custom Post Type .current-menu-item not applying on Custom Post Type Archive Page
- How to allow “Add New” capability of CPT when links to its UI are placed as a submenu?
- Dynamic Custom Post Type Plugin
- How to filter out post type meta?
- Link users to a custom post type
- Can custom taxonomies items have attached properties?
- Weird problem happening with custom taxonmy when creating/updating posts
- A good strategy to print custom posts (offer) that are checked inside the metabox of a post?
- Does anyone have a plugin that could automatically tag custom post types in wordpress?
- Very Slow Page – How to Optimize # of Queries?
- Custom Field Order by Last Name and First Name
- Get posts from a custom post type by child categories of a parent category
- CPT + CMB2: data not displaying for only first post in loop
- Custom post types and tag archive pages/permalink structure issue
- Tag Archive for Custom-Post-Type Posts yielding 404 when permalinks set to postname
- Query & Order posts by custom fields
- ACF field key/value to show on taxonomy list
- Using custom field content as expression in IF statement [closed]
- How to Upload CSV Data into Custom Post Type Data with Metabox programmatically
- Assign External Database Queries to Global Variables and Make Them Accessible
- search suggest – filter post type
- Cross reference custom post types
- Make a custom_post translatable
- How to update post meta on uploaded image from a custom form?
- Configuring a meta query with multiple post types that have the same relationship on a single page
- How can I show 1 featured post in a styled element, and the next few below differently styled
- Show all tags on custom post type
- Trying to get custom post of a custom taxonomy
- Loop increase number
- get_the_tag_list() returns bad links
- Is This Code Efficient – Or is there a better way?
- How can I create an automatic drop down menu with my tags?
- Get data from PHP to JavaScript to set position of each post on front page
- Filter content in shortcode
- Query custom post types & Taxonomies and list them in a table on a page
- Custom post type and custom taxonomy 404 on page 2
- Creating a “glossary” of WordPress posts of a specific post type
- Show current user posts in custom post type query
- Nested Custom Taxonomies | Incorrect posts when querying
- How to constrain the results to a specific post_type on tag archive page?
- Commas not displaying in implode
- How to Display the tag content of Custom Post?
- Issue with Custom Post Type Tags
- Sets post_parent in custom post type posts automatically based on cpt->page name
- Show the categories the current post has
- Front end create custom post types
- Is it a connection or relationship between 2 custom post types?
- How to display “Trash” in my custom post type?
- Custom front-end form for adding post – Category problem
- set object terms after some some time of published post – functions.php
- Why is my custom post content only viewable when signed into WordPress?
- Query custom post type that has a serialized relational advanced custom field value
- Pagination not working in custom post type. Help
- Sending current featured image to email
- Plugin Development using classes – Public & Private Callbacks
- Dynamic page for nav items used as filters
- How to use posts as tabs in a custom page?
- ACF field check value of field on all other articles
- How to convert Post Object Custom Field into Tags
- How to use POST method using custom wordpress button?
- Get meta values from parent post and save in child post
- News post with multiple permalinks? When opened from different page
- Custom Post didn’t display on tags page
- WordPress trying to query two custom types to get child from the parent
- Wrap each child and it’s grandchildren separately
- Duplicate posts in my custom loop
- Rewrite url post_tag for custom post type
- get_post_meta for Custom Post Type ( CPT )
- How to display all custom fields associated with a post type – IN THE ADMIN AREA?
- Meta box not saving
- Do not output category and tag URLs
- Why isn’t my custom post type using the corresponding custom post template?
- Default taxonomy ‘post_tag’ added to CPT managing by custom role : nothing in the metabox
- Order by custom field attribute
- How to loose the image ‘alt’ attribute in my custom post type?
- Custom Post-type not returning the right child_of
- WordPress Set A Static Page/Template For All Sub-Pages
- Add HTML before a specific div?
- How to hide home title on pages and posts?
- Is there any way of not using my_init_method in the following code (that creates a custom post type)?
- Display ONLY ONE $term (Out of 4 terms) from a Custom Taxonomy and CPT
- Can WordPress show posts based on a button that the user clicked 2 pages back?
- Custom post type is_singular condtional not working when managing sidebar display
- Issue displaying multiple TinyMCE editors with WPAlchemy