get_the_category [ WordPress-Funktionen ]
get_the_category ( $id = false )
| Parameter: |
|
| Nutzt: |
|
| Gibt zurück: |
|
| Definiert in: |
|
| Codex |
Ähnliche Funktionen: get_the_category_rss, the_category, get_the_category_list, get_category, get_the_category_by_id
Retrieve post categories.
Quellcode
function get_the_category( $id = false ) {
$categories = get_the_terms( $id, 'category' );
if ( ! $categories || is_wp_error( $categories ) )
$categories = array();
$categories = array_values( $categories );
foreach ( array_keys( $categories ) as $key ) {
_make_cat_compat( $categories[$key] );
}
// Filter name is plural because we return alot of categories (possibly more than #13237) not just one
return apply_filters( 'get_the_categories', $categories );
}Beispiele [ wp-snippets.com ]
Top Google Suchergebnisse
- Function Reference/get the category « WordPress Codex
Description. Returns an array of objects, one object for each category assigned to the post. This tag may be used outside The Loop by passing a post id as the ...
codex.wordpress.org - WordPress › Support » Limit get_the_category output
Limit get_the_category output (3 posts). shakingpaper. Member Posted 3 years ago #. Hi there,. I am using a bit of code to split my post categories into two ...
wordpress.org - Using get_the_category() in theme's functions.php - WordPress
I am trying to use get_the_category() in my theme's functions.php file. When I print the array as seen below, I get an empty array. This code works just fine in the ...
wordpress.org - wordpress - What can I use instead of get_the_category() for custom ...
Basically I've created a custom post type in WordPress with a custom ... Wordpress describes taxonomies as "Terms". There may be some help in ...
stackoverflow.com
Nutzerduskussionen [ wordpress.org ]
- arielcruzf on "How to update post category name every second?"
- jonalex on "Category Order in Posts"
- jonalex on "Category Order in Posts"
- esmi on "Category Order in Posts"
- jonalex on "Category Order in Posts"
- skywalker84 on "get_the_category() won't change between category requests"
- alchymyth on "get_the_category() won't change between category requests"
- skywalker84 on "get_the_category() won't change between category requests"
- alchymyth on "Check category outside loop"
- JOYMachine on "Check category outside loop"
