Technologies WP get menu ID by name and update nav menu October 15, 2022 1 min read // WordPress Get Menu by Name function wp_get_menu_id_by_name( $name ) { $menus = get_terms( 'nav_menu' ); foreach ( $menus as $menu ) { if( $name === $menu->name ) { return $menu->term_id; } } return false; } $menu_id = wp_get_menu_id_by_name( "Menu 1" ); // Update Nav Menu wp_update_nav_menu_item($menu_id , 12, array('menu-item-title' => __('HOME', 'landing'), 'menu-item-url' => home_url(), 'menu-item-status' => 'publish'));
Custom WooCommerce Pagination Styles How to create your own WooCommerce pagination. 1) First we add WooCommerce pagination function 2) Then we add our own styles Technologies August 20, 2022 1 min read
How to sort a WP_Query by a custom meta field The custom meta field is a number named – “mp_price”. This WP query sorts numbers from smallest to largest or get min price and sort all… Technologies January 7, 2023 1 min read
How to get the client IP address in PHP 1. Contains the real IP address of the client. $_SERVER['REMOTE_ADDR'] 2. Fetch the host name from which the user is viewing the current page. $_SERVER['REMOTE_HOST'] 3. Fetch the… PHP July 24, 2022 1 min read