How to bring menu in WP, what would the link to the current page was the text?

How to bring menu in WP, what would the link to the current page was the text?
March 12th 20 at 08:43
1 answer
March 12th 20 at 08:45
Solution
// get and not displaying menu
$menu = wp_nav_menu( array( 'echo' => 0, ) );

// replace the current link
$menu = preg_replace('/(current-menu-item[^>]+>)<a[^>]+>(.*?)<\/a>(<\/li>)/s', '$1<strong>$2</strong>$3', $menu );

// print to screen
echo $menu;


Read more https://wp-kama.ru/question/tekushhaya-stranitsa-v...

Find more questions by tags WordPress