The setcookie
function prepares the HTTP cookie header to be sent at the next page load. That’s why the $_COOKIE
superglobal is not updated automatically.
You could manually update $_COOKIE
for use on the current request. Just put this below your setcookie()
line:
$_COOKIE['mobileesp_wp_full_site'] = 'true';
By the way, I’d prefer not to work with strings like 'true'
, but just with integers (0
and 1
). You then can simply check them like this: ! empty($_GET['view_full_site'])
.
Related Posts:
- Security error WP 4.0 + WP phpBB Bridge [closed]
- User Session and Stored Cookies not get removed
- Cookie value changes back to previous value after changing
- Does the number of downloads displayed for a plug-in in the WordPress.org plug-in directory include automatic updates?
- Namespaces in WordPress – How do I initiate the main class?
- Why do I get this “plugin does not have a valid header” error?
- Which method is best to enqueue scripts
- WordPress Capabilities: edit_user vs edit_users
- Function to activate WordPress theme inside a plugin
- What is the correct way to check if WP_Filesystem can write to a directory without aking for username / password?
- Is there a WordPress Plugin that allows voting “does this coupon work” on specific links like Retailmenot
- Pass A Value From Outside To A Plugin Variable
- shortcode doesn’t work
- Built in admin ajax hooks?
- Force plugin to fail activation
- Passing select control value to block
- Can wp_script_is used in pluginA check if a script is being enqueued/registered from pluginB?
- Licensing of freemium plugin
- send_headers don’t work on wordpress multisite
- Why was my plugin rejected from the WordPress.org repository?
- $wpdb working with ajax but showing ajax error instead of success
- Adding content before the loop in category pages
- admin_notices hook show message all admin pages after plugin activate
- Default Plugin Settings Not Writing to Database
- How to define WordPress plugin shortcode globally for multisite?
- how to Include json manifest file in wp plugin
- Create a custom page template inside my wordpress plugin
- White page on custom plugin option submit
- Input with spaces in Shortcode attributes overwritten by defaults
- Unable to override pluggable function wp_mail
- 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?
- How to add Internationalization in WordPress using Javascript/React?
- creating html reusable blocks via shortcodes
- I want to auto populate data in three fields if one drop down is selected
- WP All Import – Execute Imports
- How to set taxonomy in custom plugin?
- Plugin development: Buggy plugin preview
- how to use in custom single.php template using php?
- How can I change the meta_key for a particular piece of information?
- Howto check version of another plugin and then add a submenu page to it
- Which file of wordpress manage plugins functionalities?
- How can i create page through plugin
- I should enable automatic updates?
- Check if variable is set in filter
- How to add custom table style for table block in gutenberg editor
- Does using `add_action( ‘init’…` cause performance issues?
- How to write “alt” tag in image for wordpress code?
- Issues with a WP plugin menu system
- Different custom templates for product category [closed]
- How to create plugin/ page that reads from database
- Add a “View all” button on WooCommerce product archives pages
- How do I add an options page at the bottom of the list?
- WordPress Active Plugins
- is it possible to hook every page style?
- Redirect logged in user to somepage on every page view?
- A question of etiquette when forking a plugin? [closed]
- how to request a script more than once in wordpress
- How to log custom plugin error to debug.log file
- Adding a jQuery modal dialog to the admin area
- How to make a Product page without ordering and database
- Codeless random token generation to pass into multiple tracking links in a single page load
- wp_options not returning value for logged out users?
- Gutenberg default attributes are empty when accessing in edit
- How to create admin setting for this small plugin
- Cannot run script properly with my custom plugin
- Hide all Admin Notices and move on a separate page
- How to fix caching issue in PHP data from database
- Is it okay to make a plugin to the WordPress repo, but limit it’s actions to maximum N events?
- Highlight admin menu items that are parent of existing core items
- Adding shortcodes to multiple pages with function
- SASS not showing in customized preloader plugin
- How to securely controlling data without keeping it in postmeta?
- Getting all woocommerce products from REST API call in plugin
- AJAX update fails for public/non-admin users
- Get a list of Product Categories inside a loop
- Can you develop themes and plugins while using the hosting services BlueHost? [closed]
- WordPress plugin changes not updating
- wordpress ajax pagination object value does not change
- Google analytic issue in wordpress
- Custom pages with plugin
- How to insert category name above post title in a featured pages plugin?
- Create Database Tables on Plugin Activation hook
- What’s the preferred method of writing AJAX-enabled plugins?
- How to add submenu to WordPress plugin in the same Directory of main Plugin?
- Change page according to fetched GET Parameters
- Shortcode registered from a plugin not recognized
- How to change a specific page to custom page?
- wp_update_post call really slow when official Facebook plugin is installed
- How to set-up multiple cron task with wp_schedule_event so that they do not overlap?
- How use Dynamic hyperlink on each wordpress post?
- _e in wordpress +
- WordPress Code Access to Restricted Content without Registration
- Plugin version number after code rewrite [closed]
- WP Elementor Pro causing crtical failure on website
- How can I save the selected page in the dropdown after anyone clicks on Save Changes?
- Wrong block appender button showing
- Uncaught Error: Cannot use object of type stdClass while showing the list using WP_List_Table
- plugin doesn’t retrieve data from database
- Display Any Field fromAdmin Panel in Frontend via Shortcode?