Make sure the HTTP headers are not sent already at the point you want to set the cookie. Here’s how you can test that:
function set_cookie() {
var_dump(headers_sent()); // should be bool(false)
...
Turning WP_DEBUG
on in your config.php file may help also while debugging.
By the way, you really should be doing some filtering on $_GET['id']
. This variable could contain anything. Casting it to a (positive) integer should go a long way:
$referrerID = absint($_GET['id']); // Note: absint() is a WP function
Related Posts:
- Sending the reset password link programatically
- How to change upload directory in wp_handle_upload
- How do I directly access a PHP file located in my themes folder?
- Only show div on homepage/blog index in wordpress/php
- WordPress the_content() return only one image from a specific category
- Calculate percentage of post by category
- Display all posts in current category
- file_exists() acting weird
- the_title() & the_content() are retrieving Post details inside a Page, after calling a shortcode
- register_rest_route regex option for base64 or alternate
- Is it possible to use the featured image of a page as a css background without inlining?
- PHP syntax error when using wpdb update?
- Select dropdown not showing selected value php
- Woocommerce – How to get products which have a sale between 20% to 40%? [closed]
- Warning: array_pop() expects parameter 1 to be array, boolean given
- How to migrate the posts from an old custom legacy blog to a new WordPress website?
- items_wrap not working
- Can is_page() be combined with a switch control structure?
- is it possible to force wordpress to always save thumbnails as ‘jpg’ not ‘png’
- Colorbox ajax loading of outside HTML content works perfect on localhost but not on server
- Simple Plugin with custom javascript wont work – no console error
- Using file_get_contents with Gravity Forms uploads folder to create images in the media library returning false
- Replace word in “the_content” only for index.php
- WP Walker using custom css classes
- Cannot display or echo alt text on featured image
- Using Advanced Custom Fields to create a per page slider
- Using loop pagination on single.php
- How do you ensure that a user is recognised and available for use only when it is verified through a row in the database called ‘accountVerified’?
- Javascript file is not working on single.php wordpress [closed]
- How to send Ajax request from my plugin in admin dashboard?
- How to display pictures from database?
- Output Video Download Link in template
- Display category name only once inside loop
- AJAX success response is not working but it’s saving my changes
- Best practice for show data to one specific user?
- Two menus show up
- How to determine if the sidebar is empty? Or not active?
- Path for php file for inserting data through html form
- How to create pagination for users list using custom array?
- WordPress member notification
- Unset session variable on page reload / setup but exclude AJAX
- Execute a function every hour in the background
- Create page with custom php script and fetched data
- How to show an entire post content and not also the excerpt?
- WordPress shortcode returns the data before
- One account with multiple logins
- .html end of URl affected to SEO?
- Comapare get_user_meta value
- How can get all users by current user meta?
- Sort posts in a specific way
- How to hide post in WordPress
- Only show posts from the last trailing 12 months
- `update_post_meta` not working anymore
- Custom pagination (Previous / Next)
- Getting the slug into a variable, how to echo that variable
- The user can only see their own profile
- Post meta select input, if statement
- what does $options = get_option(‘test_theme’); do?
- Set document title through shortcode plugin
- WordPress url By country code?
- How to change basename url for wp-admin?
- Prevent header and footer from loading on specific pages with template or plugin
- Implementing a multilingual WordPress site by installing several instances of WordPress and redirecting
- Weird fonts showing which are coming from database
- WordPress all php BUT index.php downloads instead of loads
- Don’t update modified post date when user add a product review or comment?
- Mysterious letters appearing at the top of a few pages
- Trouble matching strings (titles) using wp_query
- Current WordPress Page Title as Search Parameter into A Tag
- Limit the number of characters/words in an excerpt for a related posts section
- Yoast Breadcrumbs Inject Multiple Levels
- wp_remote_request to url with port 8001 not woorking
- Maximum file Upload
- Customizer textarea with script tag won’t work in live preview
- How to give custom roles the capability to edit one Menu instead of every Menu
- Unzip_file causing Media file upload error
- Primary navigation menu with timed items from custom post type
- Styling a specific post after hovering over it
- WooCommerce – Add Shipping class below each product in Shopping Cart page
- WordPress file upload
- Escaping a Single Quote in str_replace for Nav Function
- Use fetch_feed(); Totally Outside of WordPress?
- PHP tag in post content makes wordpress go crazy
- widget: input the px value from user and use it as inline style in widget function
- How to call a certain object/menubar in a PHP file
- Setting pages for posts
- Problems with plugin that fetches data from database with ajax
- How to have post count after each listed category
- why is markup routinely placed in functions in wordpress?
- When I use rewind_post() it shows menu items in my loop
- Customise Author Page?
- How to create categories out of a list of words?
- Is there a way of displaying related posts from lowest hyrachical order (lowest child category to parent category)
- Difference between php memory limit and wp memory limit?
- ‘This Field is Required.’ is Not Displaying on CF7 [closed]
- REST API custom endpoints for metaboxes
- Facing Problem While Running WordPress Hook For Archive, Categories, Author, Date Pages Only
- generate excerpt from the part of big text dump that contains keyword
- How to sort search result by post_title, then by post_content
- Custom Admin Menu Report for Specific User ID