Add custom admin menu item for pages using a certain template

I am looking to add a new, custom menu item to the WordPress admin sidebar that displays pages that use a certain template. For example: a group of pages uses the template called “Retailer Sendout” (page-retailer-sendout.php) would be displayed below the default “Pages” top-level menu item.

I have tried the following URL combinations, but none of them have worked so far.

  • http://domain.test/wp-admin/edit.php?post_type=page&page_template=page-retailer-sendout
  • http://domain.test/wp-admin/edit.php?post_type=pagetemplate=page-retailer-sendout
  • http://domain.test/wp-admin/edit.php?post_type=page&page_template=retailer_sendout

I have also tested some admin menu customization plugins, but they do not offer the ability to link to pages with a specific template name.

I am comfortable with adding a custom function to the theme’s functions.php file, but I do not know where to start.

Any help is greatly appreciated.

change the dropdown content of author post meta in edit post – admin

I am trying to customize the author meta box in the post edit page, as you all know this dropdown is using to assign a post to a corresponding author.

I would like to change the dropdown content. Like currently, its showing display name(username). But i would like to show a user meta field rather than username. Is it possible?

So in the dropdown it will be like Display name(custom user meta field).

I have seen wp_dropdown_users, but no idea how to use it so that i can achieve.

Admin privileges depending on JWT body

From a security perspective is it ok to store the permissions of a user inside the body of the Json Web Token? For example a jwt body like this:

{    "username": "lukas",    "isAdmin": true } 

The integrity of the body is verified by the signature of the token so I think it is no problem to use this technique but as it is really security relevant I want to ensure whether my thoughts are right.

WordPress Admin Page Slow. Customer Post Type is the slowest

The admin page loads slowly ever since adding Custom Post types. I’ve added them using CPT UI and Custom Fields plugins in WordPress. Whenever you click on the Custom post type from the sidebar it takes 8.74s to load. With one of the queries showing as “slow” according to debug bar plugin. See screenshot.

Context: I’ve created a site that hosts advertiser listings. We have about 700 advertisers with 20 fields.

How would one fix these load times? Does someone notice anything odd in the query?

Screenshot of debug bar details

Add customer note using order number on the admin backend

I am new to WordPress Plugin Development.

What I want:

To add a customer note using order number using php in the admin backend custom plugin.

What I know:

That we need to use WC_Order class and $ order->add_order_note().

What I cannot figure out:

How do I use the WC_Order class in the custom php page to get order details?(Do I really need to use this class? If so, then how do I use it in the php page of my custom plugin?)

In short I want to add a customer note by just using the Order Number and also get Order Status if possible.

Edit 1:

This is my plugin php code:

<div class="wrap">          <form method="POST" >           <input placeholder="Enter 3-digit Order Number" type="number" name="orderNumber"  maxlength="3">           <button class="button" value="Submit" onclick="Submit" >Add Customer Note</button>         </form>    <?php     wp_enqueue_style('wim_styles');     $  order_id= $  _POST['orderNumber'];     $  order = wc_get_order($  order_id);     echo "Order is ".$  order."order number is ".$  order_id." Status is ";     $  note = __("This is my note's text…");     $  order->add_order_note( $  note);     echo "Added note to order number:".$  order_id; ?> 

This throws following error:

Uncaught Error: Call to a member function add_order_note(). What am I doing wrong here? Please guide.