Title: change acfe_single_order
Last modified: May 26, 2022

---

# change acfe_single_order

 *  Resolved [gaspas](https://wordpress.org/support/users/arti/)
 * (@arti)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/change-acfe_single_order/)
 * I have a custom taxonomy, and I want to allow user to click and change order,
   I’am using this code
 *     ```
       function topico_pre_get_posts( $query ){
   
           if( !is_admin() && is_tax('topico') && $query->is_main_query() && $query->is_tax() ){
   
           	$order = isset($_POST['order_custom']) ? $_POST['order_custom'] : 'DESC';
   
               $query->set('acfe_single_order', $order); 
       		$query->set('acfe_single_orderby', 'title');
   
               return $query;
           }
       }
       add_action( 'pre_get_posts', 'topico_pre_get_posts' );
       ```
   
 * But it seems impossible to change acfe_single_order
    -  This topic was modified 3 years, 11 months ago by [gaspas](https://wordpress.org/support/users/arti/).

Viewing 1 replies (of 1 total)

 *  Plugin Author [Konrad Chmielewski](https://wordpress.org/support/users/hwk-fr/)
 * (@hwk-fr)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/change-acfe_single_order/#post-15936533)
 * Hello,
 * Thanks for the feedback!
 * Unfortunately the `$query->set('acfe_single_orderby', 'title')` doesn’t exists
   within the WP Query in the `pre_get_posts` hook ([See documentation](https://developer.wordpress.org/reference/hooks/pre_get_posts/)).
 * The `acfe_single_orderby` is actually a property of the Taxonomy Object itself.
   What you’re looking for is `$query->set('orderby', 'name')`.
 * Also note that you have to set a priority higher that `10` in the `pre_get_posts`
   hook in order to override the settings in the ACFE Taxonomies UI. Usage example:
 *     ```
       add_action('pre_get_posts', 'my_pre_get_posts', 15);
       function my_pre_get_posts($query){
   
           if(!is_admin() && is_tax('topico') && $query->is_main_query() && $query->is_tax()){
               $query->set('orderby', 'name');
           }
   
       }
       ```
   
 * Also note that there is nothing to `return` since it’s an action, not a filter.
 * Hope it helps!
 * Have a nice day!
 * Regards.

Viewing 1 replies (of 1 total)

The topic ‘change acfe_single_order’ is closed to new replies.

 * ![](https://ps.w.org/acf-extended/assets/icon-256x256.png?rev=2071550)
 * [Advanced Custom Fields: Extended](https://wordpress.org/plugins/acf-extended/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/acf-extended/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/acf-extended/)
 * [Active Topics](https://wordpress.org/support/plugin/acf-extended/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/acf-extended/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/acf-extended/reviews/)

## Tags

 * [order](https://wordpress.org/support/topic-tag/order/)
 * [taxonomy](https://wordpress.org/support/topic-tag/taxonomy/)

 * 1 reply
 * 2 participants
 * Last reply from: [Konrad Chmielewski](https://wordpress.org/support/users/hwk-fr/)
 * Last activity: [3 years, 8 months ago](https://wordpress.org/support/topic/change-acfe_single_order/#post-15936533)
 * Status: resolved