Filter hook for the action of listing users

Just like posts with WP_Query and pre_get_posts, there is WP_User_Query and pre_get_users that lets you modify the query parameters for fetching the users. This is the most efficient method of adjusting the list of users. e.g. add_action( ‘pre_get_users’, ‘justin_wylllie_pre_get_users’ ); function justin_wylllie_pre_get_users( \WP_User_Query $query ): void { // … modify the query object if we’re … Read more

Custom WP_List_Table displays blank rows

You’re getting the blank rows because your column headers are registered late. And you should register the headers (i.e. initialize the list table class instance) before admin notices are rendered on the page, i.e. before WordPress fires hooks like admin_notices. But your customer_list_page() function, which I believe, is a callback for either add_menu_page() or add_submenu_page(), … Read more

adding an options menu that allows saving multiple sets of said options

here an example of how to manage multiple set of options. it needs to be completed by a nonce to avoid CSRF attack and it needs also a little bit of layout. add_action(“admin_menu”, function () { add_menu_page( “Multioptions” , “Multioptions” , “manage_options” // capability to be allowed to edit options , “MY_PLUGIN__multioptions” , function () … Read more

WordPress add menu items display slug too

To directly answer your question, you can use the wp_setup_nav_menu_item filter to change properties of the nav menu item: add_filter( ‘wp_setup_nav_menu_item’, static function ( $menu_item ) { if ( ! is_admin() || empty( $menu_item->taxonomy ) || ‘category’ !== $menu_item->taxonomy ) { return $menu_item; } $menu_item->title .= sprintf( ‘ (%s)’, $menu_item->slug ); return $menu_item; } ); … Read more

Ignore “empty” fields when saving

First you need to catch the input then you can save it from $_POST So i assume your input fields names are myplugin_id , myplugin_api_key and myplugin_checkbox what you are currently doing is just going to replace the option with myplugin_checkbox You can try function register_myplugin_settings() { if ( isset( $_POST[‘myplugin_id’] ) && ! empty( … Read more

error code: 523