Last active
August 29, 2015 14:04
-
-
Save raulillana/bcf58137a59686f9bf41 to your computer and use it in GitHub Desktop.
Filter WP post_category Array in get_posts() loop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$posts = get_posts(); | |
foreach( $posts as $post ): | |
// filter post_category array | |
if( is_array($post->post_category) ) | |
foreach( $post->post_category as $k => $v ) | |
$post->post_category = $v; | |
endforeach; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment