mirror of
https://github.com/WordPress/WordPress.git
synced 2025-03-09 07:00:01 +00:00
Bad cat ID cleanup
git-svn-id: http://svn.automattic.com/wordpress/trunk@2616 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a185b7376e
commit
b3a5117b6d
@ -543,6 +543,8 @@ function &get_category(&$category, $output = OBJECT) {
|
|||||||
if ( empty($category) )
|
if ( empty($category) )
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
$category = (int) $category;
|
||||||
|
|
||||||
if ( ! isset($cache_categories))
|
if ( ! isset($cache_categories))
|
||||||
update_category_cache();
|
update_category_cache();
|
||||||
|
|
||||||
|
@ -101,6 +101,7 @@ function the_category($separator = '', $parents='') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function get_the_category_by_ID($cat_ID) {
|
function get_the_category_by_ID($cat_ID) {
|
||||||
|
$cat_ID = (int) $cat_ID;
|
||||||
$category = &get_category($cat_ID);
|
$category = &get_category($cat_ID);
|
||||||
return $category->cat_name;
|
return $category->cat_name;
|
||||||
}
|
}
|
||||||
|
@ -205,7 +205,7 @@ function single_post_title($prefix = '', $display = true) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function single_cat_title($prefix = '', $display = true ) {
|
function single_cat_title($prefix = '', $display = true ) {
|
||||||
$cat = get_query_var('cat');
|
$cat = intval( get_query_var('cat') );
|
||||||
if( !empty($cat) && !(strtoupper($cat) == 'ALL') ) {
|
if( !empty($cat) && !(strtoupper($cat) == 'ALL') ) {
|
||||||
$my_cat_name = get_the_category_by_ID($cat);
|
$my_cat_name = get_the_category_by_ID($cat);
|
||||||
if( !empty($my_cat_name) ) {
|
if( !empty($my_cat_name) ) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user