If you only want to collect the category+tag names into the output, you can try this
<?php
global $post;
$words=array();
$tags = wp_get_post_tags($post->ID);
foreach($tags as $tag){
$words[]="%23".$tag->name;
}
$cats = get_the_category($post->ID);
foreach($cats as $cat){
$words[]="%23".$cat->name;
}
$words=array_unique($words);
echo implode(" ",$words);
?>
Related Posts:
- How to array only one key from another array
- Get categories names as an array to use it in theme settings
- How to get the last category name of a child category?
- Output category list inside array
- How To Pass Array To get_the_category_by_ID() and Get An Array Back?
- Using multiple variables to assign categories to an array
- How to filter specific element of an array in wordpress/php?
- wp_get_archive for category returning different URLs on different but similar sites
- !in_array doesnt recognize category
- Getting key value of WP_Term object in wordpress
- Use Transient API to cache queries for all posts in all categories?
- Error in WP_update_post
- Looking to exclude blog posts from category Previous/Next buttons
- Looping through WP_Post Object
- Using a javascript file to access a get posts array
- Generate an array of parent/child page IDs, based on parent page name
- How do I output a database option that is an array into a get_posts array?
- Check if term object is in array
- How to exclude specific category from the get_the_category(); array
- Add HTML Attributes To Anchor Tags In `wp_list_categories()` Function
- Where do posts get the sidebar from?
- combine Code 1 with Code 2
- Using a variable in is_page(array())
- Remove duplicates – array_unique()
- get post based on category chosen in drop down – The ajax method
- Recent posts with featured image or fallback image with permalink
- Storing Array from returned database query and using the array in a new query
- Proper syntax or method for keeping url in modified isotope / category links
- get_the_tags() not iterating through for/while loop, but will with foreach
- get a simple array of all of the term names that exist in all taxonomies
- How to use $query->set with post__in?
- get_template_part based upon post’s category
- Exclude posts based on meta value
- Different post styles depending on category
- Redirect to another page using contact form 7? [closed]
- Advanced Custom Fields – display label and value only if value entered
- Define specific category name in PHP
- Category title output before opening title tag
- wp_force_remove_style’ not found
- Include Parent Term in wp_list_categories
- How can I access string value in an array?
- I’m trying to create an array with a foreach loop, but the array only stores the last item [closed]
- Filtering a function’ output for a new continued function
- If Array Values Match Another Array’s Values, Then
- How can I get all values from my array in a loop in php? [closed]
- Get all posts as an array ID => Name
- How to hide posts of a specific custom category in WordPress?
- Add new post in existing categories using wp_insert_post
- I’m unable to call img path using single quotes in an array?
- How to change logo by category
- Problem with custom loop and wp_list_pluck [closed]
- Listing titles and custom fields of entries within subcategories
- Get the id of all images in a post
- Do not duplicate posts with multiple categories in multiple loops
- Separate array output into a
- Define category ID using get_post_meta
- Update value of a associative array with update_post_meta
- Adding wp_list_categories to a specific div that was appended using jQuery
- MySQL Query Returns Array () In Shortcode
- Counting number of posts in multiple (sub)categories using shortcode
- Wrong Number of Products When Hiding Subcategory Products From Showing In Parent Category
- Convert a column of a table containing an Array as response in HTML
- Change category thumbnail size
- Create an array with all the links of the years’ archive (of a custom post type)
- Display just one post from a loop of 5 posts?
- Redux option doensn’t seem when include from functions.php
- Display Visual Composer shortcode if a post belongs in specific categories
- admin panel – How to remove “delete” button from category editing page
- Get parent category name when only child category is applied to a product
- Multiple Tag Filtering
- How to insert multiple rows and columns in database using array
- Display one random image from Media Library
- Polylang and template files
- Notice: Undefined variable
- Show subcategory name selected in specific category woocoommerce
- get_category_parents to array
- Admin backend, show post from a category and exclude the posts from subcategories
- Custom content using in_category
- How can get all users by current user meta (array)?
- PHP drop down menu for my get_category child of
- Short code into PHP
- How can i iterate through this shortcode array?
- Need to adjust condition to say if I’m pulling categories from a post, to pull only the first one
- Rearrange get_categories array compared to another array
- Non-array argument in array_merge()-function [closed]
- How to get values from wordpress listings and use them in javascript array?
- Repeatable field within repeatable group of fields
- Search in particular category in wordpress
- Query seems to be duplicated
- Top menu disapears in Category Pages when filtering using ACF
- Error trying import one category on page
- Remove the_content From Loop
- Category List in Theme Options Page
- Showing all post from all post type in admin backstage
- Code that displays images – images get shown multiple times
- Display post of specific category on page
- Displaying categories
- Use php array outside his function
- Display all categories (with link) of custom post type – WordPress
- Adding date and time to the same request