Closed ghost closed 4 years ago
Unfortunately you'll have to reach out to whoever coded that because the plugin you're using is not the official WordPress Popular Posts plugin:
/wp-content/plugins/custom-popular-posts/custom-popular-posts.php
this is the code you gave me to display popular post tags
I updated and posted the whole code with shortcode
Is that so? I don't remember ever writing that so I'm curious, mind telling me when exactly I did that?
Also, and assuming I actually wrote that code, you'll need to share the entire content of the plugin (not just that code snippet) if you want to get any help from me. What you posted isn't enough to tell what's going on.
I updated, I this something to do with PHP 7.3?
No, it's not that. I believe that one of your popular posts has no tags assigned to it which would explain why PHP complains about $post_tags
not being a valid foreach
resource.
Try this:
$post_tags = get_the_tags($popular_post->id);
if ( ! $post_tags || is_wp_error($post_tags) ) {
continue;
}
// rest of the code continues below
Describe the bug I am getting an error in php on line ( foreach ($post_tags as $tag) )
To Reproduce
Screenshots If applicable, add screenshots to help explain your problem.
Environment: