# Make post author smart action work outside The Loop

**URL:** <https://forum.pinegrow.com/t/make-post-author-smart-action-work-outside-the-loop/7599>\
**Category:** Pinegrow WP\
**Tags:** wordpress\
**Created:** [January 8, 2023, 7:39pm UTC](https://forum.pinegrow.com/t/make-post-author-smart-action-work-outside-the-loop/7599 "2023-01-08T19:39:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![adamslowe](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/adamslowe/32/4590_2.png) [@adamslowe](https://forum.pinegrow.com/u/adamslowe)\
**Post date:** [January 8, 2023, 7:39pm UTC](https://forum.pinegrow.com/t/make-post-author-smart-action-work-outside-the-loop/7599/1 "2023-01-08T19:39:59Z")

</div>

\*\* Edit \*\* This was not a bug or feature request. This was my own stupidity for forgetting to include a loop in my single.php file.

This is sort of a follow-up on the post: [Wp author action on single post template - Pinegrow WP - Pinegrow Community Forum](https://forum.pinegrow.com/t/wp-author-action-on-single-post-template/5695)

I’d also like to see the smart action work on post templates outside the loop. For example, my blog post template needs to include an author box with the author’s name, biography, and avatar image. The smart action’s function, [get\_the\_author\_meta()](https://developer.wordpress.org/reference/functions/get_the_author_meta/), works fine when called from a loop, but from a template, it needs the author passed to it by using something like “$post-\>post\_author”

Not working

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/0/053ff46ba2e86265ca4a820000e3cd1d120671ac.png)

With Post Author defined:

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/0/08461ba74190058dc3254b2644957389afb8da01.png)

I also noticed that the author description field isn’t listed in the dropdown, so I had to enter “description” in the custom meta field field ID.

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/7/75fed740f46057ed10384f2d49856e92c698ad32.png)

Lastly, it looks like some of the author actions are using older the\_author() functions that have been superseded by get\_the\_author(). It appears that the other functions like the\_author\_link() now just echo get\_the\_author\_link() and may also need to be updated in Pinegrow.

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/a/a022392ec9a54b2fc32c95d2d4f4a11129c44058.png)

My apologies if I’ve missed something obvious. It looks like the author of the original post I referenced solved his problem but never followed up in the post to tell the rest of us his solution.

---

<div class="post-metadata">

**Author:** ![matjaz](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/matjaz/32/5_2.png) [@matjaz](https://forum.pinegrow.com/u/matjaz)\
**Post date:** [January 9, 2023, 3:55pm UTC](https://forum.pinegrow.com/t/make-post-author-smart-action-work-outside-the-loop/7599/2 "2023-01-09T15:55:57Z")

</div>

@adamslowe is $post defined when the action is called? If you are using the action outside of the Loop, then of course you need to provide the author\_id explicitly.

In the referenced forum post, the Loop was missing in the single template. To my understanding, the Loop is needed also when a single post is displayed, so that all post data is correctly setup by WP before the post is displayed.

I added the “description” to the dropdown.

Re the and get actions. There are tons of such functions in WP. the\_ version outputs whatever the get\_ version returns. In the past the\_author has the second argument that returned the value when it was false. That was depreceated. That brought the function behaviour in line with the rest of the\_ and get\_ functions. The function itself is still good for displaying info.

---

<div class="post-metadata">

**Author:** ![adamslowe](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/adamslowe/32/4590_2.png) [@adamslowe](https://forum.pinegrow.com/u/adamslowe)\
**Post date:** [January 9, 2023, 4:27pm UTC](https://forum.pinegrow.com/t/make-post-author-smart-action-work-outside-the-loop/7599/3 "2023-01-09T16:27:09Z")

</div>

Okay, now I feel like a complete moron, I also had no loop in the template. It’s amazing the things you forget when you are used to reusing past projects, then decide to start a new one from scratch!
