• Resolved wstone508

    (@wstone508)


    I know I’ve touched on this before, but is there a query list of arguments for the WP_Query that return protected posts? I’m using a widget for elementor that displays posts and it accepts custom query code. I just don’t know what code to put there because I’m a code novice.

    Why use the widget? Because I can specify the styling of the returned posts, which honestly is the major drawback of this plugin. Thanks for listening Matt.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Matt Pramschufer

    (@mattpramschufer)

    hey @wstone508 I am sorry but there is not a single query for returning protected posts…

    Well, if you are just wanting to get ALL protected posts and not determine if the user has access to those posts but just pull a list of posts that have a product associated with them then you can use.

    $args['meta_query'] = [
    [
    	'key'     => 'wc_pay_per_post_product_ids',
    	'value'   => '',
    	'compare' => '!=',
    ],
    ];

    But that Custom Query feature of elementor means you need to write your own custom query like https://developers.elementor.com/docs/hooks/custom-query-filter/

    You will need to find a developer to help you out with implementing this if you do not already know how to do so. Hope that helps!

    • This reply was modified 2 years ago by Matt Pramschufer. Reason: Edited code to replace the value of the CONST
    Thread Starter wstone508

    (@wstone508)

    fair enough. Thanks anyway

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘query arg’ is closed to new replies.