Category: WordPress

Loop through categories

$categories = get_the_category(); //Returning an array with all the categories for the current post //if we have any categories then we’ll copy into an array if ($categories) { $class_names = array(); foreach($categories as $category) { // do something with $category here… } }

Server permissions problem solution

Make sure you cd into the correct folder you want the server want to be able to control before you run these commands. If you run this in your root folder, make sure you understand file permissions correctly and that your wp-config.php with user credentials now is readable by users that have server access. This …