llms_update_360_set_product_visibility()

Add course and membership visibility settings Default course is catalog only and default membership is catalog & search Courses were NOT SEARCHABLE in earlier versions


Description Description


Source Source

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

function llms_update_360_set_product_visibility() {
	$query = new WP_Query( array(
		'post_status' => 'any',
		'post_type' => array( 'course', 'llms_membership' ),
		'posts_per_page' => -1,
	) );
	if ( $query->have_posts() ) {
		foreach ( $query->posts as $post ) {
			$visibility = ( 'course' === $post->post_type ) ? 'catalog' : 'catalog_search';
			wp_set_object_terms( $post->ID, $visibility, 'llms_product_visibility', false );
		}
	}
}

Top ↑

User Contributed Notes User Contributed Notes

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





Permalink: