File "MenuFixesTrait.php"
Full Path: /home/warrior1/public_html/wp-content/plugins/google-listings-and-ads/src/Menu/MenuFixesTrait.php
File size: 652 bytes
MIME-type: text/x-php
Charset: utf-8
<?php
declare( strict_types=1 );
namespace Automattic\WooCommerce\GoogleListingsAndAds\Menu;
/**
* Trait MenuFixesTrait
*
* @package Automattic\WooCommerce\GoogleListingsAndAds\Menu
*/
trait MenuFixesTrait {
/**
* Fix sub-menu paths. wc_admin_register_page() gets it wrong.
*/
protected function fix_menu_paths() {
global $submenu;
if ( ! isset( $submenu['woocommerce-marketing'] ) ) {
return;
}
foreach ( $submenu['woocommerce-marketing'] as &$item ) {
// The "slug" (aka the path) is the third item in the array.
if ( 0 === strpos( $item[2], 'wc-admin' ) ) {
$item[2] = 'admin.php?page=' . $item[2];
}
}
}
}