Custom Post types disappear when plugin is active

I’m having a very hard time getting to the bottom of this. I’m testing the Protected Content and when I’m logged in as the admin the my custom post types are displayed on my front page but when I’m logged out the Query returns nothing. Why would this happen?

I set up the plugin’s membership as “Multiple Content Types.”

I have two types of memberships.

I have only one page of protected content and it’s not the front page.

  • Operapreneur
    • Design Lord, Child of Thor

    I've turned on wp_debug and when I'm not logged (posts NOT showing) in I'm getting this:

    Notice: Undefined property: WP_Query::$queried_object in /wp-includes/query.php on line 3946

    And when I am logged in (posts showing) I'm getting a number of notices that refer to the plugin. See attached image.

    Thanks for your help.

  • Michael Bissett
    • Recruit

    Hey @operapreneur, hope you’re doing well today! :slight_smile:

    You’ve probably done this already, but just to be certain (so that we’re not missing a step here), you’ve already tried disabling the other plugins on your site temporarily & switching to a default WordPress theme (such as the Twenty Fifteen theme), right?

    If so, I’d like to have a closer look at what’s going on here, that’s definitely some curious behavior you’re running into. Could you please send in the following:

    – Mark to my attention, the subject line should contain only: ATTN: Michael Bissett

    – Do not include anything else in the subject line, doing so may delay our response due to how email filtering works.

    – Link back to this thread

    – Include WordPress admin access details (login address, username & password)

    – Include FTP log-in details (hostname, username & password)

    – Include the custom post types being affected

    – Include any relevant URLs for your site

    On the contact form, select “I have a different question“, this ensures it comes through and gets assigned to me.

    https://premium.wpmudev.org/contact/

    Thanks a bunch! :slight_smile:

    Kind Regards,

    Michael

  • Operapreneur
    • Design Lord, Child of Thor

    Hi Michael,

    Thanks for the quick response. I’m working on this locally, so I’ll have to get it online. I have tested it out in other environments – Twenty Fifteen theme and the Underscores starter theme without any modifications or plugins. I was still getting notices in these cases but not as many.

  • Operapreneur
    • Design Lord, Child of Thor

    Hi Michael,

    I doubled check, like you mentioned, and deactivated all plugins except Protected Content and plugins shipped in the Developer plugin suite from Automattic.

    Even with the Twenty Fifteen theme I'm still getting the same notices:

    Not logged in: Notice: Undefined property: WP_Query::$queried_object in /Applications/MAMP/htdocs/wp-includes/query.php on line 3960

    Logged in notices attached: 4 on home page of Twenty Fifteen and one in the admin.

  • Operapreneur
    • Design Lord, Child of Thor

    Michael,

    One more update: I went ahead and created a test page template with the same information as the home page and the custom post types return true and not false like in the index.php or front-page.php. So, the Protected Content is in disagreement with those two templates. You can find the page template that is working correctly at the discussed url that I sent you privately /test-template/

    Thanks,

    Joel

  • Michael Bissett
    • Recruit

    Hey @operapreneur, thanks for your patience here! :slight_smile:

    I was able to have a look inside your site (though not with FTP, as I was not able to navigate your site that way, I was stuck in a directory with a .ftpquota file), and after a bit of poking around, I was able to get this working properly by enabling the “Custom Post Type Protection – Post by Post” add-on inside of:

    Protect Content -> Add-ons

    Could you confirm on your end that it’s working as it should please? :slight_smile:

    Kind Regards,

    Michael

  • Operapreneur
    • Design Lord, Child of Thor

    Thanks, Michael. Sorry about the FTP setup.

    It is working on my end and I was able to resolve it in my local environment by enabling the add-on mentioned. To me, that doesn’t seem like it should be the default setup – to protect custom post types. The plugin shouldn’t automatically protect anything unless you tell it to – at least that’s the way it’s sold.

    I’m guessing that the notices that I mentioned in at the beginning of this thread are not troublesome because they are only “notices.”

    Thanks for your help!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.