From 7d743fdc68626e1029121c42c2125a1263fecd66 Mon Sep 17 00:00:00 2001 From: Faisal Ahammad Date: Fri, 19 Jun 2026 11:47:46 +0600 Subject: [PATCH 1/2] fix: replace deprecated get_terms() string form and tag WP 6.4 conditional - course.options.php: collapse get_terms( 'tax', 'hide_empty=0' ) to single-argument array form (deprecated since WP 4.5.0). - class-llms-block-templates.php: add phpcs:ignore for the WordPress.WP.RequiresWP sniff on the traverse_and_serialize_blocks() call. Existing function_exists() fallback to _inject_theme_attribute_in_block_template_content() preserved for WP 5.9 -> 6.3. Plugin Check report: lifterlms-lifterlms-php-20260618-170100.md Fixes WordPress.WP.DeprecatedParameters.Get_termsParam2Found (2 sites) and wp_function_not_compatible_with_requires_wp (1 site). --- .../meta-boxes/class.llms.meta.box.course.options.php | 4 ++-- includes/class-llms-block-templates.php | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/includes/admin/post-types/meta-boxes/class.llms.meta.box.course.options.php b/includes/admin/post-types/meta-boxes/class.llms.meta.box.course.options.php index 5b537ef8db..8960908353 100644 --- a/includes/admin/post-types/meta-boxes/class.llms.meta.box.course.options.php +++ b/includes/admin/post-types/meta-boxes/class.llms.meta.box.course.options.php @@ -53,7 +53,7 @@ public function get_fields() { $course = new LLMS_Course( $this->post ); - $course_tracks_options = get_terms( 'course_track', 'hide_empty=0' ); + $course_tracks_options = get_terms( array( 'taxonomy' => 'course_track', 'hide_empty' => false ) ); $course_tracks = array(); foreach ( (array) $course_tracks_options as $term ) { $course_tracks[] = array( @@ -63,7 +63,7 @@ public function get_fields() { } // Setup course difficulty select options. - $difficulty_terms = get_terms( 'course_difficulty', 'hide_empty=0' ); + $difficulty_terms = get_terms( array( 'taxonomy' => 'course_difficulty', 'hide_empty' => false ) ); $difficulty_options = array(); foreach ( $difficulty_terms as $term ) { $difficulty_options[] = array( diff --git a/includes/class-llms-block-templates.php b/includes/class-llms-block-templates.php index 4e595fa6ef..82c6301aa4 100644 --- a/includes/class-llms-block-templates.php +++ b/includes/class-llms-block-templates.php @@ -373,6 +373,7 @@ private function build_template_result_from_file( $template_file, $template_slug $template = new WP_Block_Template(); $template->id = $theme ? $theme . '//' . $template_slug : $namespace . '//' . $template_slug; $template->theme = $theme ? $theme : $namespace; + // phpcs:ignore WordPress.WP.RequiresWP -- Fallback to deprecated _inject_theme_attribute_in_block_template_content() handled below for WP < 6.4.0. $template->content = function_exists( 'traverse_and_serialize_blocks' ) ? traverse_and_serialize_blocks( parse_blocks( $template_content ), '_inject_theme_attribute_in_template_part_block' ) : _inject_theme_attribute_in_block_template_content( $template_content ); From 42b0c8a946c9c42cf08b4e23a88caf9727058d29 Mon Sep 17 00:00:00 2001 From: Faisal Ahammad Date: Fri, 19 Jun 2026 11:47:51 +0600 Subject: [PATCH 2/2] chore: changelog for #3199 --- .changelogs/3199.yml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelogs/3199.yml diff --git a/.changelogs/3199.yml b/.changelogs/3199.yml new file mode 100644 index 0000000000..99aa993961 --- /dev/null +++ b/.changelogs/3199.yml @@ -0,0 +1,3 @@ +significance: patch +type: changed +entry: "Replaced deprecated `get_terms()` two-argument string form (e.g. `'hide_empty=0'`, removed in WP 4.5.0) with the modern single-argument array form in the course options meta box. Adjusted the `traverse_and_serialize_blocks()` reference to be conditional on WordPress 6.4.0+ via a `phpcs:ignore` annotation while preserving the existing `function_exists()` fallback to `_inject_theme_attribute_in_block_template_content()` for older WordPress versions."