[resolved] get_categories returns an empty array .. (5 posts)

  1. tanver
    Posted 1 year ago #

    Hi all,
    I am stuck in a strange issue, when I hit this code on one of my WordPress installations for a user other than an Administrator get_categories("&parent=4")

    this code returns an empty array BUT when an administrator level user reaches this line of code it works as expected.

    Any clue to sort this out asap will be appreciated.

  2. nickohrn
    Posted 1 year ago #

    Are you using something like Wishlist Member to hide access to content?

  3. tanver
    Posted 1 year ago #

    Yes I am using Wishlist Members to protect the contents BUT the pages I am trying on are not protected OR the user has access to that content - with a default role of Subscriber.

    As soon as I promote the user to an Administrator everything works just fine :(

    Note: I am using the "Post Tags and Categories for Pages" Plugin to have an option to link categories to the pages - need to have an hierarchical view for the Dashboard page which is linked with a certain level user.

  4. nickohrn
    Posted 1 year ago #

    There are settings in the backend of WishList Member that auto-protect terms from even being returned from a query no matter what page they are queried from. I know it sounds unintuitive (and I think it is) but that's the way WLM works. That is almost certainly your problem.

  5. tanver
    Posted 1 year ago #

    @Nickohrn, thank you very much for pointing me towards that Just worked out that I have to allow access to the relevant categories for different level in Wishlist Member's back end.

    Thanks again for the help, I am done with it :)

Topic Closed

This topic has been closed to new replies.

About this Topic