# Need to Order by an ACF Custom field

**URL:** <https://forum.pinegrow.com/t/need-to-order-by-an-acf-custom-field/5100>\
**Category:** Pinegrow WP\
**Created:** [March 12, 2021, 9:09pm UTC](https://forum.pinegrow.com/t/need-to-order-by-an-acf-custom-field/5100 "2021-03-12T21:09:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ephesian](https://avatars.discourse-cdn.com/v4/letter/e/e274bd/32.png) [@Ephesian](https://forum.pinegrow.com/u/Ephesian)\
**Post date:** [March 12, 2021, 9:09pm UTC](https://forum.pinegrow.com/t/need-to-order-by-an-acf-custom-field/5100/1 "2021-03-12T21:09:30Z")

</div>

Hi.

I am building a custom page and I have the Loop defined as a custom query. All works fine but I need to order by one of the custom fields. Does anyone know how to achieve this within Pinegrow.

I can do this manually by editing the php file, but every time I modify the file in Pinegrow it over rights the array.

 ![Show Posts - Smart](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/b/b736328aecbe95710a01bf7e3d5c4f4775b0e3c5.png)

---

<div class="post-metadata">

**Author:** ![Ephesian](https://avatars.discourse-cdn.com/v4/letter/e/e274bd/32.png) [@Ephesian](https://forum.pinegrow.com/u/Ephesian)\
**Post date:** [March 12, 2021, 9:11pm UTC](https://forum.pinegrow.com/t/need-to-order-by-an-acf-custom-field/5100/2 "2021-03-12T21:11:45Z")

</div>

Here is example from ACF documentation.

```auto
// get posts
$posts = get_posts(array(
	'post_type' => 'event',
	'posts_per_page'	=> -1,
	'meta_key' => 'start_date',
	'orderby' => 'meta_value',
	'order' => 'DESC'
));

```

And choses from Pinegrow  
 ![Order by](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/9/9ce425a5aabccba5c958f8445673b747aa383b29.png)

Am I missing something?

---

<div class="post-metadata">

**Author:** ![RobM](https://avatars.discourse-cdn.com/v4/letter/r/278dde/32.png) [@RobM](https://forum.pinegrow.com/u/RobM)\
**Post date:** [March 13, 2021, 10:55am UTC](https://forum.pinegrow.com/t/need-to-order-by-an-acf-custom-field/5100/3 "2021-03-13T10:55:42Z")

</div>

Hi @Ephesian,  
I don’t think you can do this through a smart action. I think you need to use a regular “The Loop” action. There is an “order parameters” input block that lets you specify ‘meta\_value’. If you need more help, let me know.  
Cheers,  
Bob

---

<div class="post-metadata">

**Author:** ![Ephesian](https://avatars.discourse-cdn.com/v4/letter/e/e274bd/32.png) [@Ephesian](https://forum.pinegrow.com/u/Ephesian)\
**Post date:** [March 13, 2021, 12:06pm UTC](https://forum.pinegrow.com/t/need-to-order-by-an-acf-custom-field/5100/4 "2021-03-13T12:06:44Z")

</div>

Thanks Bob.

New I was missing something simple. I was looking for ‘Show Posts’ and not ‘The Loop’.

Eph
