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?
- Common functionality between my own plugins
- Adding a text domain to every __(), _e() and __n() gettext call without a plan to create own translations
- Editor access to plugin settings
- How to pass JavaScript variable to PHP in wordpress widget?
- Unable to add admin notice on plugin activation
- How To Ignore a Filter On Applying Filter the Content In a Function
- Shortcode display outside the div
- Add CSS animation as Preloader to WordPress
- Custom Widget outputs the input but doesn’t save anything inside the textarea
- Deleting images through upload folder, but not deleting from media library
- WordPress plugin installation
- merging an array to an existing array using add_filter
- Can wp_script_is used in pluginA check if a script is being enqueued/registered from pluginB?
- Create or Update thousands of woocommerce products via PHP
- send_headers don’t work on wordpress multisite
- Update Option Error: Notice: Undefined index
- Self deactivate plugins after an action occurs
- How to periodically scrape and cache strings from remote txt files. – My First Plugin
- Avoid class name collision when using third party libraries in plugins?
- How to find the origin of a file upload from within wp_handle_upload?
- Using a custom plugin to capture input data via Ajax and PHP
- Display post lists in 2nd paragraph
- How to get the element ID from new menu list that added with add_filter()?
- creating html reusable blocks via shortcodes
- Replacing a plugin function with a custom renamed function doesn’t work
- How to output CMB2 select options from repeated groups select elements?
- How to deal with WordPress and Pocket API to automate content curation on my hosted wordpress blog? [closed]
- WP All Import – Execute Imports
- Which file of wordpress manage plugins functionalities?
- Why can’t I call a (member) function from within a foreach?
- Are there action hooks for comments?
- Shortcode Attributes to Return different $_POST
- what is the point of telling add_filter how many parameters you want passed to the function?
- can’t unzip file
- Want to create custom design of progress indicator in wpforms
- WordPress Custom Hook with Class method
- Change plugin descriptions
- Adding discount functionality to the cart
- update_post_meta is not working for me when I use e.preventDefault for update button
- How to use Datatable with Ajax when creating plugin on WordPress?
- Showing how many times is plugin activated or deactivated
- Return function results within shortcode
- Plugin communication between sites that use it?
- Form tries to download a file on submit
- insert multiple entries in database using a loop issue
- How to echo a plugin’s function into a template?
- Theme editor removes backslashes
- It possible to implement an adhoc php web application with wordpress?
- shortcode which is introduced into entry the blog, and appears in side bar
- Plugin Hook: Get posts
- How to Overwrite validate_plugin function
- making a glossary with wordpress
- date function not correctly returning date
- Undefined variable _POST
- How to prevent page load on form submission
- Send email notification when meet the condition
- WordPress: code structure
- Create WordPress category dynamically