Skip to content

Instantly share code, notes, and snippets.

@tw2113
Last active March 28, 2022 18:54
Show Gist options
  • Save tw2113/d91939af0da36fc88ecf to your computer and use it in GitHub Desktop.
Save tw2113/d91939af0da36fc88ecf to your computer and use it in GitHub Desktop.
JetPack Popular Posts class.
@jdcauley
Copy link

I don't understand how this isn't more popular, I was planning to do exactly this today.

@rohitink
Copy link

Pure Genius!

@shadoath
Copy link

shadoath commented Feb 4, 2020

A little code we added to line 151 in order to skip certain categories.

$terms = wp_list_pluck(wp_get_object_terms($post->ID,  'category'), 'slug');
if (array_intersect(['obituaries', 'lifestyle', 'police-reports'], $terms)) continue;

Hope this can help someone else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment