Last active
December 22, 2021 12:28
-
-
Save nikitasinelnikov/cb787277f7a62a5e3cb188bb181d9417 to your computer and use it in GitHub Desktop.
Replace Ultimate Member placeholders after nav menus rendered
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
remove_filter( 'wp_nav_menu_objects', 'um_add_custom_message_to_menu', 9999 ); | |
/** | |
* Add dynamic profile headers | |
* | |
* @param $items | |
* @param $args | |
* | |
* @return mixed | |
*/ | |
function um_add_custom_message_to_menu_custom( $items, $args ) { | |
if ( ! is_user_logged_in() ) { | |
$items = UM()->shortcodes()->convert_user_tags( $items ); | |
return $items; | |
} | |
um_fetch_user( get_current_user_id() ); | |
$items = UM()->shortcodes()->convert_user_tags( $items ); | |
um_reset_user(); | |
return $items; | |
} | |
add_filter( 'wp_nav_menu_items', 'um_add_custom_message_to_menu_custom', 9999, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment