The query vars filter is unnecessary for what you’re doing here, as you’re not using it in a query. Adding it to the URL as a GET parameter will not make it appear in the array of query vars, as there’s no mechanism that converts a GET var to a query var, you’ve only ensured it won’t be removed if it’s added to the query.
As long as the GET var is unique and not reserved by WordPress, there’s nothing that should prevent setting and then accessing a GET var via normal means: $_GET['my-preview']
.
Related Posts:
- Difference Between Filter and Action Hooks?
- How to create an API for my plugin?
- How to add sub-menu to a menu generated by wp_nav_menu by using plugin
- How can I load a page template from a plugin?
- How to get Post ID with the Add Filter Function
- Explanation of the “posts_join” and “posts_fields” filter hooks?
- How do you use the plugin boilerplate loader class to hook actions and filters?
- add_filter OO with parameters
- How Can I Add a Filter to Class Instance Only?
- Is it possible to remove next-post / previous-post with out creating a custom template?
- How do I Make a Theme “plugin-ready”?
- How to remove unwanted panels inside InspectorControls from core blocks in Gutenberg
- function triggered by “manage_users_custom_column” filter not working
- Proper way to use apply_filters() with class functions?
- add_filter and remove_filter added before and after wp_query
- How to modify post content before writing to database?
- Actions or filters fired when data is saved in a custom table
- Some nav-menu filters do nothing
- Filter on the_content ignores shortcodes
- Determine which theme location a wp_get_nav_menu_items is for
- How to change wordpress post title?
- Display only certain posts based on visitor’s country?
- What’s the difference between hooks, filters and actions? [duplicate]
- How to use filter hook ‘post_updated_messages’ in coherence with action hook ‘save_post’
- Conditional add_filter?
- Is it possible to create an action hook using do_action() within add_action()?
- Hook for post permalink update
- Dynamically Override Fancy Title
- Calling apply_filters on non-documented hooks
- WordPress Media mime type filter problem 4.0
- How to allow Unfiltered HTML in a wordpress multisite install
- How to add custom content under plugin row in WordPress admin plugin list?
- Changing bloginfo description from a plugin
- Is there a way to verified if an add_filter is already applied?
- Define a function outside a class and call the function using action or filter hook
- Does add_filter work outside functions.php
- Synchronize Custom post type tags to WordPress default posts tags
- multiple functions with same filter
- Woocommerce – Hide a Column in Cart Table
- Version upgrade: can my plugin filter the SQL statements issued during a database upgrade?
- add_filter : Passing an array instead of the callback function?
- Get a custom table to an array
- How do I alter the comment form ‘allowed tags’ text in a plugin?
- WordPress after content Hook & external template part
- Namespaced action and filter tags
- Two functions utilizing registration_errors filter
- Is there a Filter that I can use to filter the tags before they are inserted in to the database?
- WordPress is automatically linking plain text email addresses
- best practice for query string values – get_query_var always empty for my value supplied in query string
- get_current_screen() return null
- Problems with: manage_${post_type}_posts_columns
- Custom filter in admin edit custom post type responding with invalid post type?
- How To Change Logout Screen Title
- Add code inside specific wordpress standard function
- Check for template part, else filter content
- $paged always 0 on plugin’s custom page
- Why doesn’t my simple the_title filter get applied?
- How to filter the_content() & include content from template
- Adding rewrite rule dynamically
- Prefixing plugin hooks (actions/filters) with a wrapper class or functions
- Replace youtube embed in wordpress
- Can’t get woocommerce_get_price_html to work [closed]
- Search and Filter
- WordPress pre_get_posts with combined results of two queries (OR)
- How can I replace content in the WP Admin area before an admin page is rendered?
- How to filter content for specific content variable
- WordPress custom taxonomy check box to dropdown
- Admin Posts List (edit.php) by post IDs
- Using ob_get_content to get_search_form puts into infinite loop
- Valid filenames for add_action’s first parameter
- How do I access the menus produced by Dashboard > Appearance > Menus
- WordPress class, using add_action to call member function does not work
- wp_get_post_terms Order by not working
- How to get all queries’s results after they have executed?
- How to get the post excerpt using post object?
- Remove an action by extending class and replacing it
- Prevent WordPress automatically processing certain URL queries
- hook filter after the_content on a specific page
- Bind a function with its own argument to show something dynamically after every content
- Why in this archive page that call query_posts() function show only the last 10 posts?
- insert query on a custom table using ajax with jQuery plugin Jeditable
- Hook add_attachment error
- Call to undefined function is_home() or any conditional tags
- WooCommerce change Tax Class programmatically when Recalculating an existing Order [closed]
- Taxonomy archive page listing terms instead of posts
- Update variable value via add_filter
- Make wordpress join default user metas with a column from another table while displaying the wp_users table on the users screen
- Configure WordPress to Generate Scheme-less Relative URLs
- Gravity Forms Anchor only on Front Page?
- How to find list of all functions bind to a particular hook from my plugin?
- Include HTML (Bootstrap Modal Box) with a plugin into my header
- Brainstorm – Slow Query from Plugin Need to Speed It Up
- WP_NAV_MENU filter targets all menus
- Checking for existing title in custom db query not working
- Adding filter to the title without affecting the menu title
- How to validate inputs with filter in register_setting callback
- Can I log the searches that are returning 404 in the DB?
- Do Not Back Up? Is there any accepted way to tell backup and clone plugins to skip a certain file? [closed]
- Ninja Forms: Front-End Forms, Post ID?
- Attributes array not saving values