Use the hook pre_get_post
see codex
Related Posts:
- Checking url from plugin [duplicate]
- Passing a parameter to filter and action functions
- Get a list of all registered actions
- Preventing a plugin from updating
- WP_query parameters for date range
- Customizing subject in comment notification e-mails
- insert data in database table from plugin with WP3.1
- WP showing “warning: call_user_func_array()”, What to do?
- Which hook should be used to validate custom form fields on the login form?
- Hook (upgrader_process_complete) running moment
- Comparisson between date() and a date from wp_postmeta
- Use external link in the add sub menu
- How can I add a custom meta value on file upload?
- How can I filter blog name?
- why does the add_action(‘the_content’) overwrite my page
- Fatal error: Class not found in
- Showing Notifications While Activating Plugin
- Woocommerce Shipping module available only for type of products [closed]
- WordPress Plugin Boilerplate – add_action hook in static “activate” function
- Put code into body tags near top, using a plugin
- Can I run multiple queries with $wpdb->prepare?
- Hook before & after plugin / core update
- publish_post plugin hook doesn’t always pass $post->post_content
- get_plugins() doesn’t work after plugins_loaded
- add_action in functions.php, do_action in plugin?
- add action for displaying posts using a shortcode
- Randomize attachment IDs
- Are there hooks for WordPress updates?
- Pass info from functions.php to plugin
- Plugin activation hook in an abstract class
- Remove rewrite rules generated by plugin during deactivation
- Change permalink structure hidden button edit
- WooCommerce shop page orderby [closed]
- WordPress filter that hook after each action/filter hook
- When to use action hooks and plugins
- Not getting author rank when using return
- Is there an earlier hook than login_head or login_enqueue_scripts?
- Gravity Forms plugin: How to use “gform_editor_js” action hook? [closed]
- Map a custom id to wordpress post id
- Calling plugin function inside custom plugin for onclick event
- get current date + 90 days and checking every day
- Calculate price and display on woocommerce product single page under price (simple price, variable price) [closed]
- Using AJAX to generate front end / viewer end pages
- Hook into existing tinyMCE button
- How to get post ID with hooks publish_post, new_to_publish, etc
- WooCommerce search products between price range using WP_Query
- Add sub menu page in your plugin
- how to change automatic placing of social plugins below content?
- How to Loop Through all Posts and Count Attachments using Get Media Attachments
- the_post hook is not firing for me
- Deactivate JS Script in Plugin Shortcode
- Plugin Development – Functions or Hooks?
- Adding Plugin Assets to Header
- Error in pdf generating plugin using FPDF
- Return multiple values in a shortcode attribute
- What are admin hooks
- How do I add $_SESSION[”] to my wordpress page?
- How to use filter to disable adding a product to wishlist?
- WordPress: Add custom add_filter for custom functions
- Loop returns the current page’s permalink and guid instead of the post in the loop
- Add user meta after a user has registered and logged In [closed]
- Function added to hook “new_to_publish” not executing – custom plugin
- How to get CPT category checkbox list and show post of selected(multiply) checkboxes via ajax?
- Pagination not working
- How to find the WordPress Nextgen galleries which are not used in WordPress posts?
- Hook for plugin to insert into entry-meta
- Use a hook or filter, or overwrite this Gamipress function?
- Hook from plugin doesn’t fire up from external PHP script
- How to search post titles with whole words only, but not the exact word only?
- Use get_pages() before another plugin modifies it
- How to Join wp_posts & wp_postmeta table using custom query
- What database state changes happen after a post is manually “updated” with no changes?
- Is there a hook similar to “save_post” which only fires AFTER the post is completely published?
- Randomize post (and page) IDs on generation
- save_post hook partly firing in update post
- My plugin runs on every single WordPress page, but I want it to run only on activation
- Fatal error: Uncaught Error: Cannot use object of type WP_Error as array in /../plugins/rm-payment.php
- The function called on the wp head hook becomes null
- Show post object of any page in frontend
- Use action, filter, or hook to append HTML to WordPress plugin function
- Passing function into add_action always returns the first argument
- Hook to display element as product on category page
- Is it possible to disable a theme programmatically?
- How to use information from the database in the front-end?
- plugin not hooking to my custom hook
- wp_login_form() ignoring login_form action hook
- History of page, interval of years
- Modify a plugin’s content
- Plugin does not create a custom table upon activation
- Plugin hook breaks new WP 4.0 media library grid view?
- WordPress filter function using query modifications
- WP-Snap too slow (caused by WP_Query?)
- WordPress Meta Query: Relation is not working correctly
- WordPress ultra slow if I click on posts?
- Variable scope in plugin outside loop [closed]
- Insert data in custom table during new post creation
- WordPress Hooks : Where to place callbacks that repetitively yield the same effect?
- How to Add Extra Text In WordPress Title Before Post Publish
- Why is my activator class adding the files/running the actions I add?
- Admin Notice is only localized when displaying the “Plugins” Backend Page