llms_update_343_update_relationships()

Rename meta keys for parent section and parent course relationships for all LifterLMS Lessons and Sections


Return Return

(void)


Top ↑

Source Source

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

function llms_update_343_update_relationships() {

	global $wpdb;

	// Update parent course key for courses and lessons.
	$wpdb->query(
		"UPDATE {$wpdb->postmeta} AS m
		 JOIN {$wpdb->posts} AS p ON p.ID = m.post_id
		 SET m.meta_key = '_llms_parent_course'
		 WHERE m.meta_key = '_parent_course'
		   AND ( p.post_type = 'lesson' OR p.post_type = 'section' );"
	);

	// Update parent section key for lessons.
	$wpdb->query(
		"UPDATE {$wpdb->postmeta} AS m
		 JOIN {$wpdb->posts} AS p ON p.ID = m.post_id
		 SET m.meta_key = '_llms_parent_section'
		 WHERE m.meta_key = '_parent_section'
		   AND p.post_type = 'lesson';"
	);

}

Top ↑

Changelog Changelog

Changelog
Version Description
3.4.3 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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