try something like this…
you need to first call global $post;
then get the author id like $author_id = $post->post_author;
Related Posts:
- How to use WP_Term with (menu) argument in the wp_nav_menu?
- Function/Class to list categories with checkboxes
- How can i call from custom fields to the category editor?
- How can you check if you are in a particular page in the WP Admin section? For example how can I check if I am in the Users > Your Profile page?
- add_action hook for completely new post?
- Why does WordPress add 0 (zero) to an Ajax response?
- Passing arguments to a admin menu page callback?
- function deactivate_plugins does not exist
- Understanding WordPress functions’ naming conventions
- Authoritative answer on which boots first – Plugins or Themes?
- How can I change the frequency of a scheduled event?
- When is it appropriate to put functions on page template vs. functions.php?
- Determine which theme location a wp_get_nav_menu_items is for
- Checking for existence of a page by title?
- anything like add_meta_box for categories?
- Missing “category_children” option when dynamically creating categories via a plugin
- Dynamically Override Fancy Title
- Problems with removing admin bar
- Can we create a category list page in WordPress?
- Problem with `wp_mail()`
- Calling a function from functions.php in custom page/ blog post
- Check if I am in the Admin Panel (wp-admin)?
- What is the Difference between directly call a function and call a function using add_action?
- Call to undefined function get_blog_option()
- Undefined function wp_set_password
- Whats the difference between blog_info(‘stylesheet_url’) difference get_stylesheet_uri()
- Does add_filter work outside functions.php
- What function to hook for changes made in status and visibility of a post
- Plugin Uninstall and Deactivate via Options Menu
- How can I add a CSS rule to edit.php?
- Show add_meta_box by selecting a specific category
- Which are the hooks run before/after when a category’s deletion?
- add more custom post types and custom role to the code
- Get the category name outside of the loop in category.php
- Enqueue scripts in footer
- is user logged in not working
- how do you prevent showing a particular category on the admin dashboard for specific user roles?
- Override class inside $atts shortcode_atts in WordPress
- add_rewrite_rule works in themes function php but when moved into plugin it stops working
- Where can i find wordpress auto update code flows?
- $reverse_top_level works the opposite way according to Codex?
- correct way to call javascript into hook function
- how to search users by ajax live search
- Remove unwanted elements for a wp_nav_menu
- How do I get the sub categories of the parent when in a sub category?
- How to add user details to different tables immediately after user registration
- mysql_real_escape_string() vs. esc_sql() in WordPress
- Checking for existence of a page by title?
- how to get context information inside my funcion
- Redirect to another page using contact form 7? [closed]
- How to modify files inside wp-includes directory in wordpress
- Fatal error: Call to a member function get_page_permastruct() on a non-object
- wp_get_post_terms Order by not working
- Why wp_die() doesn’t work with wp_redirect but exit() works
- Warning: call_user_func_array() expects parameter 1 to be a valid callback
- Autogenerate a Table of Contents
- Alternative functions for mysql_free_result and mysql_ping in wordpress functions
- WordPress multisite,use same cookies across all website?
- Check if post belongs to any category
- Call to undefined function is_home() or any conditional tags
- unregister_setting() vs delete_option() for plugin update
- How to change WooCommerce loop product title HTML output in single product page and archive page
- How to output functions from plugin inside theme
- wp_schedule_event is registered but function isn’t running
- How to show parents of current page category, excluding the category?
- Overwriting a plugin function
- Writing editor content to a file
- Load stylesheet in edit category page?
- Listing wordpress users with a search function
- How can i listing current category and Featured Category post list?
- Adding tables to dashboard pages programmatically?
- How to exclude categories from get_categories() select list inside a widget admin panel
- How to Show Category List With Corresponding Links?
- WP 3-way voting system: On to something! Please help!
- Custom Settings Plugin Save foreach checkboxes
- Can someone explain what’s the use of parse request function in WordPress?
- function add custom fields to media gallery
- Determine if term is Category or Tag
- Override category archive page title (not the head title)
- Make visible page only in the trash
- WordPress: I wanted to use Add rewrite rule multiple times for multiple CPT in my plugin
- WordPress Ajax not returning Response
- Post is uncatagorized in publish_post action
- Does hooking into a plugin action / filter override the plugin’s function for that hook?
- Woocommerce product not appearing in category list page when created programatically [closed]
- Remove tag from all posts when publishing new post
- WordPress plugin how to run function when button is clicked
- foreach argument to get specific file types getting too many returns
- Remove from a div by class name from post page if post author role is not administrator
- Ajax not working to insert, query and result data
- WordPress permalink setting
- How can I add recent posts to menu like mashable
- Creating an archive page listing external data
- Why is ‘register_activation_hook’ undefined?
- Dynamic banner for use on external sites
- Why does this fail: Disabling plugins enqueue_script() in functions.php
- What method would I use to show an image in between X amount of posts on category archive? [duplicate]
- How to plugin function code move to theme function.php ? I’ve tried below code but not working [closed]
- WordPress simple ‘Hello World’ plugin – problems
- Create WordPress category dynamically