What I need and why
Because of my plugins (WC_Membership) get_categories() is filtered due to restricted content.
Now I need every category listed for comparison reasons (which I would do via get_categories()), but not all categories are listed if not admin. Is SQL the way to go for my problem? (Dont use WP_Query -> would get filtered by the other plugin)
TL;DR: I need unfiltered categories - probably via SQL
Normaly I do ...
$cats = [];
foreach (get_categories() as $key => $value) {
$cats[] = $value->cat_ID;
}
echo "Cats: ".implode(',',$cats);
Will return Cats: 1,225,228,494,490,492,232,241,233,234,235,236,237,238,242 (unfiltered as admin).
When a user with restrictions runs this script, they would get something like Cats: 1,225,228 (but I need all categories listed)