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.
Return Return
(void)
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 );
}
}
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 3.6.0 | Introduced. |