Change the Ultimate Member Restriction via functions.php
-
Hello,
I am using your plugin on a new website we are working on. I have several Custom Posts Types name “Tax Sales”, that we can set the UM Restriction for login and logout users.
I am trying to via a cron job that runs every hour check all tax sales and if the tax sale date (custom field )is older than now, I want to make all those past tax sales restricted to only login users.
Is there a hook or filter I can use to change the Ultimate Member Restriction for each post?
This is the code I have so far.// run cron jobs to change posts to private when tax sale date has passed add_action( 'past_results_private', 'past_results_private_now' ); function past_results_private_now() { $args = array( 'post_type' => 'tax-sales', 'meta_key' => 'tax-sale-date', 'meta_value' => date("F j, Y, g:i a"), 'meta_compare' => '<', ); $post_query = new WP_Query($args); if($post_query->have_posts() ) { while($post_query->have_posts() ) { $post_query->the_post(); ///// CHANGE THE ULTIMATE MEMBER RESTRICTION TO LOGIN USERS ONLY } } }
thank you
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Change the Ultimate Member Restriction via functions.php’ is closed to new replies.