Is this still happening in the latest version?
Hi, no, i’ve had no notices in the latest version.
regards theo
Cool. Thank you for the detailed report, just wanted to make sure it was fixed.
Dear Luke,
I found a simple plugin you made a while back that is exactly what I need but it does not work in the newest version of WordPress. If it’s okay, could I get you to have a quick look at it?
https://ww.wp.xz.cn/plugins/count-posts-in-a-category/
Sorry for posting here. I just saw your name and remembered it from when I was testing different plugins.
I guess this code needs an update:
if( !empty( $slug ) ) { $field = 'slug'; $value = $slug; }
elseif( !empty( $id ) ) { $field = 'id'; $value = $id; }
elseif( !empty( $name ) ) { $field = 'name'; $value = $name; }
else return 0; // nothing specified
Maybe to this:
if( $slug !== '' ) { $field = 'slug'; $value = $slug; }
elseif( $id !== '' ) { $field = 'id'; $value = $id; }
elseif( $name !== '' ) { $field = 'name'; $value = $name; }
else return 0;
But I’m not sure what happens here:
$term = get_term_by( $field, $value, $taxonomy ); // get term object
if( isset( $term->count ) ) return $term->count;
else return 10;