wp_loaded
is too early, the request hasn’t been parsed yet – use the action wp
instead (called at the end of WP::main()
, once the request has been parsed and posts have been queried).
To get the user object, just use $author = get_queried_object();
Related Posts:
- The correct method to pass query vars in AJAX using ajaxurl
- Display user’s total comment count outside The Loop
- Getting the action’s tag name within the action
- WordPress Infinite Scroll without using any plugin
- Admin Bar (Toolbar) not showing on custom PHP file that loads WordPress
- How to add query vars with paginated URLs?
- WordPress Custom Page Template in a different directory
- How to stop loading multiple copies of jquery
- Adding php directly into widget shortcode
- Custom Loop Pagination on WordPress
- How to place login logout link on menu that redirects users back to current page?
- where to include a php file
- Woocommerce price including tax with formatting from options
- Understanding child theme functions.php
- WordPress 2.8.5 & ‘Responsive Twenty Ten’ – error
- wordpress inserting posts programatically through a url
- How does WooCommerce ensure that a product doesn’t run out of stock during payment? [closed]
- Can I change a variable in a content part while calling it?
- How do you target virtual pages in code?
- Placing the_content inside shortcode not working
- Must Use Plugin Causing Query Error
- action hook wp_head higher priority as all other plugins/hooks
- Shortcode return function with link href inside PHP
- How can I add an alert (like the old javascript alerts) to my WP page?
- PHP get the first post separately from array returned by wpdb->get_results()
- How to add just one specific page to widget without plugin?
- How to use transient in this code for related post?
- Why is $_REQUEST an empty array in admin-ajax.php?
- Change behavior of the tag
- Is it acceptable to treat a filter like an action?
- adding custom user input fields in WordPress admin dashboard gives error The link you followed has expired. Please try again
- Woocommerce hook run after an Order been created through REST API
- Fetch post block/field data as JSON with WordPress API
- How to pre populate a form field with a link of a current user’s author profile?
- wp_head function not outputting
- PHP echo inside javascript
- Value prints outside of the echo
- get_total () returns 0 – woocommerce [closed]
- If ‘editor’ is empty, then
- Different Subdomain changes page content
- Removing the comment function within wordpress
- php redirect with custom user roles set and working but redirect not working for when users are logged in
- Display Yoast meta-description `wpseo_desc` within loop of categories and fail silently if no data is set [closed]
- Does get_post function counts as view?
- Get ACF options field in PHP acting as CSS
- Permalinks are not working in WordPress in digitalocean
- PHP code inside Shortcode
- Bootstrap Carousel HTML structure and funny output [closed]
- Amend theme php to include certain category in header
- add category to posts with tag wordpress
- Missing a text-domain esc_attr_e
- Get all posts from categories
- How to insert data from metabox to custom table
- How to Generate a list of Most Commented post?
- Updating From Mobile App – Exposing Site to Hacking
- is user member of a group, show them categories [closed]
- How to add ASCII symbol after each recent post [closed]
- How can i programmatically change the SKU of a product based on product variation?
- Export post data with xml to other site using php soap
- Execute PHP code only with specific user role
- Repeat a function with 24hrs gap for n number of days
- Add a custom WooCommerce settings tab with sections
- How to serve WordPress folder over subdomain?
- How to call my PHP function with AJAX ? wp_query
- How to route root path / to /xyz in nginx?
- Get the same SKU from woocommerce itself for simple and variable products
- Show sidebar only to author of post
- No more get_option(‘date_time’) in WordPress 5.5?
- how to add custom select field to wordpress edit page
- How to update post content of all posts with tag?
- Make WooCommerce product categories only show images on homepage
- How to Change Site Elements based on referring URL
- WP post meta – for loop inside for loop
- Insert data from form to database
- My search results are only showing 5 posts?
- WP_query meta_query slow with OR and DATES
- WordPress Query Crashes Browser
- Matching multi user
- WordPress using get_term to retreive slug not working as expected
- auto metakey value on post tile
- On a custom template, should I use wp_footer? [duplicate]
- Front end post submissions do not get submitted in the category
- How to pass parameter that ends up being part of a class name with wordpress shortcode
- how to check for wordpress Query errors
- calling a function from a class in your template
- WordPress and magic quotes
- Custom single.php files for different post formats
- Troubleshooting “loopback requests that take too long”
- AJAX & PHP | Call a specific PHP function from a PHP file via AJAX?
- Order woo products, but first products must be with acf fields
- Remove /category/ from category (archive) page URLs (without using a plugin)
- JSON Object Value Show Undefine
- understanding wp_next_scheduled
- WordPress 6.1.1 UTF8 Slug Limit Increase
- WordPress directories not writable after PHP version upgrade
- How do I unset category from a product in wordpress by code
- php 8 compability admin interface
- How can I make below code to show grouping by country ranks in same div, example if in second loop rank 2nd must be show in same 2nd class div
- add_rewrite_rule image from /images/site2/favicon.ico to /favico.ico
- Load style and script for custom post type metabox