PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 4.9.4
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v4.9.4
4.9.4 4.9.3 4.9.2 4.9.1 4.9.0 4.8.2 4.8.1 4.8.0 4.7.0 4.6.2 4.6.1 4.6.0 4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 4.5.1 4.5.0 4.4.1 4.4.0 3.3.4 3.4.0 3.4.1 3.4.2 All 202 releases
← All changes | views/layouts/base.php +14 -1 4.5.2 → 4.9.4 View file →
@@ -1,5 +1,10 @@
1 1 <?php
2 +// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- view template receives variables via extract(); prefixing is impractical.
3 +
4 +if ( ! defined( 'ABSPATH' ) ) {
5 + exit;
6 +}
2 7 if ( $terms_query_args == false ) {
3 8 return;
4 9 }
5 10 $terms = get_terms( apply_filters( 'betterdocs_base_terms_args', $terms_query_args ) );
@@ -38,9 +43,11 @@
38 43 $ancestors = [];
39 44
40 45 if ( is_single() && ! empty( $_current_queried_object_id ) ) {
41 46 $_category_ids = wp_get_post_terms( get_the_ID(), 'doc_category', [ 'fields' => 'ids' ] );
42 - $ancestors = get_ancestors( $_category_ids[0], 'doc_category' );
47 + if ( ! is_wp_error( $_category_ids ) && ! empty( $_category_ids ) ) {
48 + $ancestors = get_ancestors( $_category_ids[0], 'doc_category' );
49 + }
43 50 }
44 51
45 52 if ( ! is_wp_error( $terms ) ) {
46 53 do_action_ref_array( 'betterdocs_layout_base_loop_start', [ & $terms, &$_defined_vars ] );
@@ -54,8 +61,14 @@
54 61 $docs_query_args = ! isset( $docs_query_args ) ? $_docs_query_args : wp_parse_args( $docs_query_args, $_docs_query_args );
55 62
56 63 $terms_count = count( $terms );
57 64 $terms_number = 1;
65 +
66 + $_term_ids = wp_list_pluck( $terms, 'term_id' );
67 + if ( ! empty( $_term_ids ) ) {
68 + update_termmeta_cache( $_term_ids );
69 + }
70 +
58 71 foreach ( $terms as $term ) {
59 72 $_counts = betterdocs()->query->get_docs_count(
60 73 $term,
61 74 $nested_subcategory,