If all you are doing is setting a cookie on a page then why the complexity?
Check this out for a simple answer http://www.w3schools.com/php/func_http_setcookie.asp
My only thought is that you are then trying to redirect them back to WordPress and if so you may wish to check this Setting custom cookies in WordPress
I’d say your error “missing function 2” is coming from incorrect syntax for time
.
Related Posts:
- Change meta tags programatically
- How do I find the code executed when wp_head() is called?
- remove_action on after_setup_theme not working from child theme
- Add tags to the section via functions.php
- Remove Actions/Filters added via Anonymous Functions
- Trying to use add_action and do_action with parameters
- Check if post is being published for the first time, or is an already published post being updated
- How to use the do_action () with parameter
- Perform an action when post is updated/published
- WordPress Theme Update Action?
- Extract image from content and set it as the featured image
- Do WordPress’ cron’s clean up expired transients?
- add_action in a function, is it possible?
- Using a private method as an action callback from within a class
- Refresh page after form action
- How to restrict actions and filters “properly” by conditions
- How to count number of functions attached to an action hook?
- Add action hook conditionally – only when home.php in use
- Using add_filter() in Widgets
- How can I tell if I’m on a login page? [duplicate]
- Convert hyphen to underscore in permalinks
- Using get_terms for custom taxonomy in functions.php
- Fatal error: Call to undefined function add_action() – an untouched problem
- How to hook into the quick edit action?
- How to remove the embed_footer?
- Reuse variable in hook callback
- Call to undefined add_action() in theme’s functions.php
- WooCommerce add_action hook results in 500 error
- How to add iOS & fav icons to the theme?
- Automatically Add Specified Value to Attachment Metadata upon Upload
- Can’t Update function.php after writing short code
- How to update feed only 2-3 times a week (for Feedburner email)?
- Trying to inject twitter metadata into using wp_head action in functions.php – get_the_excerpt() returns null
- How would go about if I just want a temporary function?
- How do I edit wp_head and/or functions.php to remove rss-feed which isnt used and dont validate?
- Passing arguments to my function with do_action and add_action is not working
- Pass parameters to function through an action
- Accepted arguments value in hook functions
- How to select a page within admin?
- How to manage arrays from custom functions stored in functions.php?
- How do I pass arguments for multiple functions hooked to a single action?
- How to add new embed handler not supported by oembed?
- Which action hook to use for function?
- Custom HTML in specific category single page and its descendant categories
- Modify a function without editing template
- Don’t delete a page if it holds users
- How do I add Bootstrap and LESS to my migrated WordPress site?
- Which action does wp_update_user triggers?
- Passing a variable via wp_head and then calling it on the page
- How can I get my Script to work on the Login page?
- Trigger a custom function when option are saved in admin area
- Is there an alternative to get_template_directory_uri()?
- WordPress converts media extention URL automatically to video player
- Reuse variable in hook callback
- Setting youtube size in functions.php
- Wait a result before enqueue
- Redirect to another page if the user is logged in when pressing again the login button on menu bar
- Multiple Loops Meta Data
- Remove adjacent_posts_rel_link under 3.2?
- Function added using `add_action()` not being called
- Difference b/w Simple function call & do_action call
- jQuery does not work
- Override the WordPress core function wp_referer_field
- Set Taxonomy based on post status
- Two functions with different arguments and add_actions, but identical code
- add_action template_redirect not working for home page
- I can’t seem to install Font Awesome locally [closed]
- AMP – Change rel=”canonical” from functions.php [closed]
- Auto Generated HTML source code formatting
- Scripts not loading when using the wp_enqueue_scripts action
- Adding javascript to functions.php causes problems with my template
- Is there a way to prevent a function/method from being called outside a specific hook?
- Auto-Tweet if Type is ‘Status’ using OAuth
- Missing argument for the function
- problem loading stylesheets to wp_head dynamically
- current_user_can comma list vs OR (||) list
- Adding code before post title with the_title produces weird results
- Add back in child theme what the parent theme removed with remove_action
- login_headertitle is deprecated since version 5.2.0
- How to properly refresh page after form action?
- Init action and refresh page after form action
- How can I pass a shortcode value to the head in wordpress functions.php
- 400 Bad Request – JavaScript App calling Custom wp-json endpoint
- Different favicon on different pages
- Changing where my author box is printed
- Insert Content Before div#main from the functions.php File
- Use add_action within template
- Problem in using Customizer
- Problem with custom function when I go back with the browser
- Replace admin header logo with an image
- New checkbox in custom widget isn’t saving data
- Function to echo (or display?) wordpress tags in the head section
- colorbox not loading in
- template_redirect action only firing if logged in
- How to use wp_enqueue_script properly?
- WordPress functions.php conditional include another functions file
- Using get_terms for custom taxonomy in functions.php
- Issue passing action class to nested function. Admin Columns
- Does hook have an effect on increasing the page load?
- How to Override Page Template if URL matches query?