🔒 EXCLUSIVE: Changeset/ - Uncensored 2025

Skip to:

Changeset 14176


Ignore:
Timestamp:
12/26/2025 08:05:06 PM (3 days ago)
Author:
espellcaste
Message:

Check if the Group Types taxonomy exists before adding its menu.

Before adding a menu item for the Group Types taxonomy, confirm the taxonomy exists (if it was not disabled).

Props shawfactor and vapvarun.

See #9293 (14.0)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/14.0/src/bp-groups/bp-groups-admin.php

    r13937 r14176  
    4242
    4343/**
    44  * Redirects the user on the Goups network admin screen when BuddyPress is network activated.
     44 * Redirects the user on the Groups network admin screen when BuddyPress is network activated.
    4545 *
    4646 * @since 7.0.0
     
    5858function bp_groups_admin_types_menu() {
    5959    if ( ! bp_is_root_blog() ) {
     60        return;
     61    }
     62
     63    // Bail if the bp_group_type taxonomy is disabled.
     64    if ( ! taxonomy_exists( 'bp_group_type' ) ) {
    6065        return;
    6166    }
     
    106111 * @since 1.7.0
    107112 *
    108  * @param array $custom_menus Array of BP top-level menu items.
    109  * @return array Menu item array, with Groups added.
     113 * @param string[] $custom_menus Array of BP top-level menu items.
     114 * @return string[] Menu item array, with Groups added.
    110115 */
    111116function bp_groups_admin_menu_order( $custom_menus = array() ) {
    112     array_push( $custom_menus, 'bp-groups' );
     117    $custom_menus[] = 'bp-groups';
     118
    113119    return $custom_menus;
    114120}
Note: See TracChangeset for help on using the changeset viewer.