Advanced Sidebar Menu - Version 8.8.3

Version Description

  • Introduced advanced-sidebar-menu/menus/category/top-level-term-ids filter.
  • Supported PRO version 8.9.2.
Download this release

Release Info

Developer Mat Lipe
Plugin Icon 128x128 Advanced Sidebar Menu
Version 8.8.3
Comparing to
See all releases

Code changes from version 8.8.2 to 8.8.3

advanced-sidebar-menu.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin URI: https://onpointplugins.com/advanced-sidebar-menu/
5
  * Description: Creates dynamic menus based on parent/child relationship of your pages or categories.
6
  * Author: OnPoint Plugins
7
- * Version: 8.8.2
8
  * Author URI: https://onpointplugins.com
9
  * Text Domain: advanced-sidebar-menu
10
  * Domain Path: /languages/
@@ -19,7 +19,7 @@ if ( defined( 'ADVANCED_SIDEBAR_BASIC_VERSION' ) ) {
19
  return;
20
  }
21
 
22
- define( 'ADVANCED_SIDEBAR_BASIC_VERSION', '8.8.2' );
23
  define( 'ADVANCED_SIDEBAR_MENU_REQUIRED_PRO_VERSION', '8.7.0' );
24
  define( 'ADVANCED_SIDEBAR_DIR', plugin_dir_path( __FILE__ ) );
25
  define( 'ADVANCED_SIDEBAR_MENU_URL', plugin_dir_url( __FILE__ ) );
4
  * Plugin URI: https://onpointplugins.com/advanced-sidebar-menu/
5
  * Description: Creates dynamic menus based on parent/child relationship of your pages or categories.
6
  * Author: OnPoint Plugins
7
+ * Version: 8.8.3
8
  * Author URI: https://onpointplugins.com
9
  * Text Domain: advanced-sidebar-menu
10
  * Domain Path: /languages/
19
  return;
20
  }
21
 
22
+ define( 'ADVANCED_SIDEBAR_BASIC_VERSION', '8.8.3' );
23
  define( 'ADVANCED_SIDEBAR_MENU_REQUIRED_PRO_VERSION', '8.7.0' );
24
  define( 'ADVANCED_SIDEBAR_DIR', plugin_dir_path( __FILE__ ) );
25
  define( 'ADVANCED_SIDEBAR_MENU_URL', plugin_dir_url( __FILE__ ) );
readme.txt CHANGED
@@ -6,7 +6,7 @@ Tags: menus, sidebar menu, hierarchy, category menu, pages menu, dynamic
6
  Requires at least: 5.4.0
7
  Tested up to: 6.0.1
8
  Requires PHP: 5.6.0
9
- Stable tag: 8.8.2
10
 
11
  == Description ==
12
 
@@ -158,6 +158,10 @@ Yes. Based on whatever page, post or category you are on, the menu will change a
158
 
159
 
160
  == Changelog ==
 
 
 
 
161
  = 8.8.2 =
162
  * Fixed widget id generation with block based widgets.
163
  * Introduced `advanced-sidebar-menu/core/include-template-parts-comments` filter.
6
  Requires at least: 5.4.0
7
  Tested up to: 6.0.1
8
  Requires PHP: 5.6.0
9
+ Stable tag: 8.8.3
10
 
11
  == Description ==
12
 
158
 
159
 
160
  == Changelog ==
161
+ = 8.8.3 =
162
+ * Introduced `advanced-sidebar-menu/menus/category/top-level-term-ids` filter.
163
+ * Supported PRO version 8.9.2.
164
+
165
  = 8.8.2 =
166
  * Fixed widget id generation with block based widgets.
167
  * Introduced `advanced-sidebar-menu/core/include-template-parts-comments` filter.
src/Menus/Category.php CHANGED
@@ -170,7 +170,7 @@ class Category extends Menu_Abstract {
170
  * If on a single this could be multiple.
171
  * If on an archive this will be one.
172
  *
173
- * @return array
174
  */
175
  public function get_top_level_terms() {
176
  $child_term_ids = $this->get_included_term_ids();
@@ -178,6 +178,8 @@ class Category extends Menu_Abstract {
178
  foreach ( $child_term_ids as $_term_id ) {
179
  $top_level_term_ids[] = $this->get_highest_parent( $_term_id );
180
  }
 
 
181
  $terms = [];
182
  if ( ! empty( $top_level_term_ids ) ) {
183
  $terms = get_terms(
@@ -188,9 +190,10 @@ class Category extends Menu_Abstract {
188
  'order' => $this->get_order(),
189
  ]
190
  );
191
- }
192
- if ( is_wp_error( $terms ) ) {
193
- return [];
 
194
  }
195
 
196
  return $terms;
170
  * If on a single this could be multiple.
171
  * If on an archive this will be one.
172
  *
173
+ * @return \WP_Term[]
174
  */
175
  public function get_top_level_terms() {
176
  $child_term_ids = $this->get_included_term_ids();
178
  foreach ( $child_term_ids as $_term_id ) {
179
  $top_level_term_ids[] = $this->get_highest_parent( $_term_id );
180
  }
181
+ $top_level_term_ids = apply_filters( 'advanced-sidebar-menu/menus/category/top-level-term-ids', $top_level_term_ids, $this->args, $this->instance, $this );
182
+
183
  $terms = [];
184
  if ( ! empty( $top_level_term_ids ) ) {
185
  $terms = get_terms(
190
  'order' => $this->get_order(),
191
  ]
192
  );
193
+
194
+ if ( is_wp_error( $terms ) ) {
195
+ return [];
196
+ }
197
  }
198
 
199
  return $terms;