The variable you have named $query
is actually the WP_Query instance having filters applied to it.
You can simply call its function get
to retrieve query vars.
For example:
function votes( $where, $query )
{
$sort = $query->get('sort');
if (!empty($sort)
$where .= " AND $sort >= votes";
return $where;
}
Related Posts:
- Redirect to another page using contact form 7? [closed]
- Customizing subject in comment notification e-mails
- How to Loop Plugin Option Field Set?
- Saving Plugin settings to the database
- How to list the Hooks and order of execution in current loading page? [duplicate]
- HELP: Integrating WP with raw PHP code once published button is hit
- I would like to use create a function in my custom plugin to tell WP to use a different header
- Scope for PHP Variables Assigned in functions.php or a plugin
- WordPress Plugin Page is Loading in Admin Content Container Instead of Separate Page
- add_query_arg not working
- wordpress plugin is not activating from widget
- Edit Yoast SEO breadcrumbs output [closed]
- Conditional attributes and logic per product category
- WordPress get_avatar function not correct working
- execute function after one completed
- Plugin onclick button activate other plugin
- Different registration form for different roles
- More gentle way to hook WordPress custom url
- How to add custom function to pluggable.php
- Checkbox show / hide output result
- How to convert Currency from USD to other IP Based currency in Php function
- Allow a particular user to access a particular plugin?
- Cookie value changes back to previous value after changing
- Is there any way to sync Facebook Comments and with comments on WordPress website?
- Custom Plugin: How to Include Install Buttons of other 3rd Party Plugins?
- adding dynamic/multiple slug values in ‘option_none_value’
- working code, not working – Plugin Dev
- 500 Internal server error wp_handle_upload_prefilter
- Is admin section completely customizable in terms of styling?
- register_activation_hook doesn’t fire at all
- My ajax request don´t work and return 0
- WordPress environment not loading properly
- WordPress Add advertising ads befor and after content with periority [closed]
- Populate select option with JSON file
- Saving an array to get_options
- Saving plugin data returns “You do not have sufficient permissions to access this page.”
- How to add a handler for a button in plugin?
- Can anyone tell me why I can’t edit a plugin when it is installed without having to re-install?
- Doing action based on input from options menu
- How use Dynamic hyperlink on each wordpress post?
- How can I save the selected page in the dropdown after anyone clicks on Save Changes?
- How can I save the selected page in the dropdown after anyone clicks on Save Changes?
- Mixed results with is_page() WordPress function, when using $this, or self
- Read page- or post-content across different builder-plugins
- wp_head filter not executed inside custom class
- Extend Elementor Archive Posts widget with a custom skin in order to show multiple badges
- Custom preview_post_link not working for draft post
- Creating search filter through plugin
- Loading class files via autoload method
- Add Fields with Sub-Fields to WP Job Manager
- Determine plugin name from within plugin_action_links filter
- WordPress plugin installation
- Override the core function locate_template
- merging an array to an existing array using add_filter
- How to redirect Old Post URL to new Post and keep Old post Comments?
- Can wp_script_is used in pluginA check if a script is being enqueued/registered from pluginB?
- Modifying Footnote Plugin for Descriptive Title Attributes
- New Plugin: Post update pushes a copy as a revision
- Getting media library popup in custom plugin admin page
- Create or Update thousands of woocommerce products via PHP
- How to Replace Words with Hypertext Link But Ignore Previously Existed Links?
- send_headers don’t work on wordpress multisite
- jQuery function didn’t work in my plugin
- bulk change of image setting “link to” to “link to: image url “
- Placement of Code in Plugin for hooking `save_post`
- Display a text message if the field is not found and not if found
- Reposition Woocommerce Message
- Sanitizing, Validating and Escaping in WordPress (Plugin)
- Escape when echoed
- The Point of Using apply_filters()
- Plugin exceeds memory limit
- How to get post URL in the_content filter?
- How to remove xmlns on language_attributes()?
- Add a plugin before main container
- WP Job Manager Category Drop-down; Change Placeholder Text Via Filter
- How to get subscription key or id using Woocommerce Subscriptions [closed]
- How to get variables from fucntion.php to my plugin files
- How to include code into functions.php file via a plugin
- Avoiding Duplicate function names in Post Loop (WP_Footer script)
- Missing argument 3 for wp_register_sidebar_widget()
- Write to / remove from default .htaccess file from plugin?
- Update Option Error: Notice: Undefined index
- How to add class in plugin only for network site?
- Plugin Development sqlite or WordPress’ database
- Pass info from functions.php to plugin
- How to cancel WordPress’ action/filter when using OOP with anonymous callback
- How to trigger $_GET request within admin plugin page?
- How to generate video out of images via WordPress plugin
- plugin development: problem with functions
- How can I get WordPress to save comments in markdown format?
- WooCommerce get_price returning wrong price when used via ajax
- How to ‘clone’ a wp plugin to make small changes
- Open Post Thumbnail in New Child Theme File in WordPress
- Shortcode button dosent work for all posts. Work for first post only
- Where should I save an API key of my user when installing my plugin?
- Is Wrapping intval() Around esc_attr() Redundant for Escaping Input?
- Programatically download a plugin
- Redirecting to home page after login as custom role WordPress
- Add keywords meta to index.php page
- Custom form action to handle data inside a plugin