When you are on an author.php
template page, you should be able to get the current author via $wp_query->get_queried_object()
. That is also what is_author()
uses when you want to check for a specific author.
Do you also have a question about setting the cookies? I don’t think WordPress has specific cookie functions. wp_setcookie()
is deprecated by wp_set_auth_cookie()
, but that seems to do more advanced stuff than just set a simple cookie.
If you use a specific visitor tracking system (like Google Analytics) I’m sure you can also save this kind of “lead” info with them. If you want to know more about that, the Pro Webmasters Stack Exchange site is probably a better place.
Related Posts:
- Function to return true if current page has child pages
- Cleaning up WordPress to improve performance?
- List of all theme customizer control types?
- Need help with friendly URL’s in WordPress
- Custom post status not working
- Keep one user logged for a year?
- Enabling Sessions in WordPress 3.0
- difference between esc_attr(), strip_slashes(), strip_tags()?
- How to preserve PHP modifications while upgrading WordPress?
- Set the transport of the Customizer ‘header_image’ core setting to ‘postMessage’
- Get the sidebar ID in which the current widget was dropped
- Post source link plugin – small modification
- Getting $comments outside the comment template
- Change comments form title on a page by page basis
- media_handle_upload weird thing
- How to let a single post have its own domain name
- simple wp_insert_post example
- Setting up the child theme so as to enable right-to-left WordPress?
- Comment filtering (search)
- Prevent WordPress from loading comments
- delete an array element when its date expires
- Why is PHP Cookie via plugin only set when logged in as Admin and not regular users? and other questions
- How to add default images into theme customizer image control?
- Best way to pass arguments to another page in WordPress
- WP_Query with the “offset” argument
- WordPress change author email notify message?
- Set user loggin status?
- How do you output custom code between posts in the loop?
- Overriding a theme redux file in child theme
- Modifying Footnote Plugin for Descriptive Title Attributes
- Add filename to attachment page url
- Count widgets of a certain type
- Widget Javascript code (ajax)
- How to Replace Words with Hypertext Link But Ignore Previously Existed Links?
- How to break down importing of feeds
- How to remove tag cloud from taxonomy admin edit page?
- PHP can I add line numbers to file_get_contents()
- Setting custom canonical urls
- Setting a cookie upon specific URL visit
- Create simple Cookie Box for WordPress
- Create another “Display Site Title and Tagline” checkbox, “Header Text Color” setting and control
- How to customize a permalink (URL) structure?
- Converting HTML Template to WordPress Theme
- Edit Yoast SEO breadcrumbs output [closed]
- post_content is stripping HTML when adding a new post? [closed]
- How do i wrap woocomerce attribute in list?
- get_theme_mod outputs number when using WP_Customize_Cropped_Image_Control
- Showing different pages depending on a cookie value
- How to make a cookie be on the whole site instead of being on a specific page/
- Is there a hack for using is_page() within the function.php file?
- same user role or copy the user role to be same as the other role
- Set cookie for visitor
- Customize field names in backend profile edit page through function.php [duplicate]
- Custom Database Table and foreach
- Problem with custom function from jQuery slider tutorial
- Different profile page by role
- WP insert post Redirect after function has executed
- Add array of post id’s to a category?
- WP-Bakery – Add custom colors to buttons with template colors
- implement custom roles in custom plugin
- Trying to update Woocommerce meta values
- Cookie value changes back to previous value after changing
- When is the wp-settings-[time] cookie generated?
- Post source link plugin – small modification
- Custom Plugin: How to Include Install Buttons of other 3rd Party Plugins?
- update_user_meta as multiple value but with same meta key
- Adding discount functionality to the cart
- How to assign a specific service to a specific provider based on location
- Precheck fields when I add a new post
- Having trouble creating two shortcodes, one for logged in user and one for visitors
- Delete post meta by serialized meta value
- working code, not working – Plugin Dev
- WordPress load javascript file if something… (after the page is loaded)
- Remove node from multisites?
- Automatically refresh page if widget is added to page?
- Stored meta from attachment, video length?
- Allow user to select location and then set cookie for location in WordPress
- Where can I find the declaration of `$_wp_theme_features`?
- How do I routinely extract the thumbnail of the most recent post?
- Create 2-layered dropdown menus for custom taxonomy and custom post type
- Use WP_Query Data In Cookie
- A Customizer checkbox control that sets the setting to “” or to “blank” and show() or hide() a color control
- My customizer’s setting doesn’t set to the default and needed to click the control’s “Default” button before it’ll be set
- Edit a custom admin page
- Check if values exists DB
- WordPress causing all code to be displayed on line 1. Receiving multiple errors after cleaning cookies and cache
- How to add button to top of theme customizer?
- How can I clear the theme mod settings?
- Display a list of users with avatar filterable with alphabets
- Post thats in Two Categories, only want to display name for one
- Custom Slider Per Page created
- Select area and checkbox data is not saving?
- WordPress: code structure
- WP Custom tables query
- Keep users logged in Without Remember Me
- Add multiple HTML attributes to an Elementor button
- Woocomerce custom add to cart button edit functionality [closed]
- How to change product title color in shop page if product has specific product tag (Woocommerce)?
- How to capture number input from wordpress form into acf field in woocommerce
- Restricting page by user role