llms_update_380_set_access_plan_visibility()

Add visibility settings to all access plans and delete the “featured” meta values for all access plans


Return Return

(void)


Top ↑

Source Source

File: includes/functions/updates/llms-functions-updates-380.php

function llms_update_380_set_access_plan_visibility() {
	$query = new WP_Query(
		array(
			'post_status'    => 'any',
			'post_type'      => array( 'llms_access_plan' ),
			'posts_per_page' => -1,
		)
	);
	if ( $query->have_posts() ) {
		foreach ( $query->posts as $post ) {
			$plan       = llms_get_post( $post );
			$visibility = $plan->is_featured() ? 'featured' : 'visible';
			wp_set_object_terms( $post->ID, $visibility, 'llms_access_plan_visibility', false );
			delete_post_meta( $post->ID, '_llms_featured' );
		}
	}
}


Top ↑

Changelog Changelog

Changelog
Version Description
3.8.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.