If you use the built in get_terms
function you end up with a quick one liner:
function get_positional_ids(){
return get_terms( 'category', array('fields' => 'ids', 'name__like' => '_'));
}
no custom SQL, safe and simple.
Related Posts:
- Display random categories on the front page (Finding and Editing Theme Functions)
- How to add classes to images based on their categories?
- current_cat_ancestor Alternatives
- Add body class of category parent
- Changing a function in function.php to a shortcode – for listing categories of only a certain post type
- Php string not working in WordPress Functions.php (trying to fetch 1st category for each blog that post appears in the sidebar)
- Add class to Categories Widget
- How to Acheive the custom woocommerce category template
- How to add a rel attribute to images that contains their categories?
- How to set child post categories to parent post categories when updating parent post?
- Assign category using custom field?
- How To Get WordPress Categories Link List?
- Changing post category from dropdown
- Manipulate Output of wp_list_something: select menu instead of li’s
- Make Categories a Dropdown Menu in Media Library
- Programmatically Create Category and sub Category
- Attach parent category template to all subcategories
- exclude a category from a search on a specific page
- Get the category name outside of the loop in category.php
- Is it possible to change any of the HTML/URL returned from the_category()
- Custom HTML in specific category single page and its descendant categories
- Possible to display shortcode based on the category?
- Unset Category if other Category is unset during post transition
- Select pages by category
- Show Primary Category first when I display post categories
- How do I hide or remove ‘Category’ from wordpress breadcrumbs
- Ordering posts by publish date not working?
- Categories as main menu items and subcategories as nested lists
- Is there a WP function to get taxonomy name from taxonomy_term_id?
- Get category URL for current post
- Need help “sanitizing” a custom function that pulls category slug into body class
- allow only one post in specific category
- How to obtain the recent posts without their content in an efficient way?
- Setting a default text for excerpts of a particular category
- Running script based on Category
- Remove a category from a post when saving a new post
- How to fix get_the_category function returning incorrect slug?
- Return category name with & Ampersand doesnt work
- Access category within rss2_head hook?
- issue with if/elseif in_array inside foreach loop display only one post
- Randomizing wp_tag_cloud() in child theme
- add_filter to specific WooCommerce Category
- How to rewrite wordpress search to work on specific category
- Image loading function not working on archive.php template
- Exclude Category ID in function
- Problem with calling custom function in a foreach loop
- Specify multiple categories for custom post template – FATAL ERROR
- “All posts” in the category widget
- Get Attachment Category Name
- Display ACF category image on archive and single template files
- Get slug of current category in functions.php
- This code is supposed to only allow user to be authenticated if accountVerified is equal to 1, but it still allows user to be authenticated otherwise
- Display a list of random terms from custom taxonomy with shortcode
- Change category display name function
- Display link to category over featured image
- sort title descending with title with number
- Delete oldest wordpress post (SQL query)
- Remove the ‘category’ url for one category type
- Custom Function.PHP Code Not Working on One Site
- Adding new Category does not refresh the backoffice
- How do i tweak my wp Post title base on category of the post
- how to remove a tag in the_category function
- Menu and category highlighting for a single post
- i can’t use wordpress functions in ajax loaded php file
- Graphic before title – Specific Category
- require_once() Causing categories and tag pages on dashboard to not refrsh
- different body classes for each category
- Database SQL Error, Should Work
- Database Query not working
- How To Get WordPress Categories Last Update Date?
- How to get tags and categories?
- Query is not work
- How to Insert A List of Posts in A Category Written by the Author into the Author Archive
- Removing all Category pages with one exception
- Get category of post inside save_post hook
- paginate_links() don’t properly work in search.php?
- How can I get $id variable in widget’s form function?
- Pinterest Integration Using functions.php
- Changing itemprop from logo to image on custom logo?
- Change Rating range in Link Manager
- function to erase swear words
- Function call via ajax – can’t figure it out?
- What WordPress function to use to get meta value by using meta keys?
- How to create an onclick event on an image in a post?
- Remove Jetpack infinite-wrap
- Create a Woocommerce product widget with category filter
- Undefined variable issue for wp_get_attachment_image_url
- Why isn’t comment validation working?
- “Conditional query tags do not work before the query is run. Before > then, they always return false. “
- Change ‘Categories’ to ‘Topics’
- Code I am placing in the wp_footer is going outside the entire HTML frame!
- Restoring pages in wordpress
- Different body image backgrounds on different pages, posts and categories
- Language switcher for subdomains
- How to add a class name to the ancestor of a post?
- is_user_logged_in() isn’t working
- Retrive post by tags PHP code
- Add custom css to theme
- Why don’t ‘wp_nav_menu’ CSS classes work until a menu is created?
- WooCommerce, change “Add to Cart” to “Link to Product”, only for specific categories