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
- Where is the best place to use add_filter
- Problems with autoloading classes via sp_autoload_register / maybe interfering WP-specific autoloader
- Can we completely remove the WordPress Sitemaps (WordPress 5.5)?
- Rename existing old uploaded images containing accented French characters (not during upload)
- Failed to invoke other hook from the init hook
- Create plugin that works in background
- Loading class files via autoload method
- How to redirect Old Post URL to new Post and keep Old post Comments?
- Modifying Footnote Plugin for Descriptive Title Attributes
- Getting media library popup in custom plugin admin page
- jQuery function didn’t work in my plugin
- Escape when echoed
- How to get variables from fucntion.php to my plugin files
- Redirecting to home page after login as custom role WordPress
- How to stop or remove an action being called inside a function of an extended class
- Date calculations from 2 custom fields
- How to enable specific plugin only based around shop manager role?
- How to check current user before all actions and filters?
- Adding a new field to the address field type in gravity forms
- qTranslate remove default directory from link
- Create a plugin from within WordPress
- Class variables not correct on page
- Load Javascript from Plugin in One Page Only?
- Why is one phpunit test throwing an error on one class when all other classes are similar without error?
- Checking the count within a foreach loop
- Api external with wordpress
- Using meta_query in a WP_Query not working for numbers properly
- Hook for altering the content of all wp mails
- implement custom roles in custom plugin
- Using OR Condition with facetwp facets
- How to copy the all WordPress media items to another custom plugin folder?
- How can we get this dynamically as this folder may not be by the same name always → wp-admin
- Fatal error “Call to undefined function is_plugin_active” each time the plugin is activated
- Redirect to a page while maintaining search query parameters without causing an infinite loop
- Why is my shortcode not working?
- Getting Fatal error: Uncaught Error: Call to undefined function plugin_dir_path() when linking to another file within my wordpress plugin
- front end editor creation for Restropress plug in – displaying information from a WP admin area, on a different URL
- implement checkbox or toggle switch in plugin code
- Create a form and have custom menu display based on user answers?
- Problem with conditional woocommerce custom checkout field
- trying to create simple plugin to filter categories from all authors
- How can I insert a record into a custom table from my custom form in my custom admin page?
- how to create table during plugin installation in side a class
- Posting code inside the post instead of in the template file using shortcode
- Metabox Data not saving
- Including a PHP file via a function that is part of a plugin?
- Pass strings to plugin function [closed]
- How to tweak a plugin without preventing it from updating
- WP Members additional fields on user profile [closed]
- how to search through plugin in wordpress cimy-user-extra-fields?
- Integrate Razorpay quick payments plugin with contact form7 plugin
- How to Add Extra Text In WordPress Title Before Post Publish
- Function not being called on form submit, only blank admin-post.php page
- WordPress Convert queries to slashes using function.php
- WordPress Throwing Deprecated Errors on its own Files
- How can we extent core/group or cover block?