Tag: Trick

PHP Tricks

  1. To see the var_dump output with decoration see below –
echo '<pre>', var_dump( $style_post ), '</pre>';

How to get Category Slug by Category ID in WordPress?

I have got the category id list with the variable $my_cats_id.

So now I have used my own trick to get the slug –

echo str_replace( ‘ ‘, ‘-‘, strtolower( get_cat_name( $my_cats_id ) ) );