HEX
Server: nginx/1.24.0
System: Linux webserver 6.8.0-87-generic #88-Ubuntu SMP PREEMPT_DYNAMIC Sat Oct 11 09:28:41 UTC 2025 x86_64
User: wpuser (1002)
PHP: 8.3.6
Disabled: NONE
Upload Files
File: //proc/self/cwd/wp-content/plugins/ultimate-member/includes/admin/core/packages/2.0-beta1/menus.php
<?php
$roles_associations = get_option( 'um_roles_associations' );

/**
 * Transferring menu restriction data
 */
$menus = get_posts( array(
	'post_type' => 'nav_menu_item',
	'meta_query' => array(
		array(
			'key' => 'menu-item-um_nav_roles',
			'compare' => 'EXISTS',
		)
	),
	'numberposts' => -1,
) );

foreach ( $menus as $menu ) {
	$menu_roles = get_post_meta( $menu->ID, 'menu-item-um_nav_roles', true );

	if( !is_array( $menu_roles ) ) {
		$menu_roles = array();
	}
	foreach ( $menu_roles as $i => $role_k ) {
		if( $role_k != '' && isset( $roles_associations[ $role_k ] ) ) {
			$menu_roles[ $i ] = $roles_associations[ $role_k ];
		}
	}


	update_post_meta( $menu->ID, 'menu-item-um_nav_roles', $menu_roles );
}