WP_Query filter by custom meta

You can do a meta query using OR relation. After that you use get_users() function to get all the users you selected in the query. Then output their nicename in a list with using foreach. $your_url=”https://www.yoururl.com”; $your_description = ‘your description’; $args = array( ‘meta_query’ => array( ‘relation’ => ‘OR’, array( ‘key’ => ‘user_url’, ‘value’ => … Read more

Removing menus from users other than the administrator

If you want to exclude menu items by their labels: function hide_menu_items( $items ) { $items_to_exclude = [‘Menu Item 1’, ‘Menu Item 2’]; if ( !current_user_can( ‘manage_options’ ) ) foreach ($items as $key => $item) if ( in_array( $item->title, $items_to_exclude ) ) unset( $items[$key] ); return $items; } add_filter( ‘wp_get_nav_menu_items’, ‘hide_menu_items’, 20 );

Modify WordPress Page Title ()

It’s important to read the documentation for filters. The documentation for pre_get_document_title says (emphasis mine): Filters the document title before it is generated. and $title (string) The document title. Default empty string. So when using pre_get_document_title, the title has not been set yet, so when you do this: return $title . ‘ new title’; $title … Read more