How to use query string URL parameter in WordPress custom page?

How to use query string URL parameter in WordPress custom page?

In order to display the table corresponding to a desired year, I wanted to use a query string parameter (GET) in the page URL, so I could create a list of links with this “&sellyear= value ” parameter for each existing years. Ex : http:// localhost/lywebsite/wp-admin/edit.php?post_type=vehicle&page=eai_admin_vehicles_sales_submenu& sell_year=2018

Can a custom table be used in WP _ query?

For large queries involving custom data, it’s more efficient to keep the data in a custom table with each type in its own column. You can still use the normal WP_Query process by altering the SQL through the “posts_request” filter.

How to make a meta query in wp-admin?

You need to translate it into proper WP_Query arguments. Do so in the “pre_get_posts” action. All post queries pass through here, so be sure you only alter applicable queries. Depending on where the years are stored, you probably will be composing a meta_query argument.

Is there a way to change the WP _ query process?

You can still use the normal WP_Query process by altering the SQL through the “posts_request” filter. But if efficiency is important, you’re better off querying directly through global $wpdb, then looping through the results for output.

What does my plugin do in wp-admin?

My plugin is basically a link display page, for instance if you want to display a page with links to other websites. In wp-admin I have a menu item on the left side bar added with this code:

How to get admin page URL in PHP?

The only thing you need to specify is the file name ( admin.php ). URL for menu page or options page has ‘page’ parameter ( page slug defined in add_menu_page () or add_options_page () ). You can always get the current page from $_GET [‘page’] param, so URL for the options page is:

How to extract a parameter from a URL?

If you expect rich text from parameter, then run it through wp_kses or similar functions. All of this information plus more info on the thinking behind the function can be found on this link https://www.intechgrity.com/correct-way-get-url-parameter-values-wordpress/