llms_update_360_set_product_visibility()

Add course and membership visibility settings


Description Description

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


Top ↑

Return Return

(void)


Top ↑

Source Source

File: includes/functions/updates/llms-functions-updates-360.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 ↑

Changelog Changelog

Changelog
Version Description
3.6.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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