Skip Navigation

[Resuelto] Sorting Columns with Dollar Signs & Commas

Este hilo está resuelto. Aquí tiene una descripción del problema y la solución.


Sorting columns that include numbers with dollar signs & commas


It needs custom codes, for example:

Relevant Documentation:

This support ticket is created hace 4 años, 4 meses. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

Etiquetado: ,

This topic contains 4 respuestas, has 2 mensajes.

Last updated by marcusC-4 hace 4 años, 4 meses.

Assisted by: Luo Yang.


I previously had a support thread about sorting columns that include numbers with dollar signs & commas. At the time, the support provided worked great. Minesh applied a custom function that allowed sorting to work very well.

However, the code doesn’t appear to be working anymore as I cannot sort the columns as expected.

Here is the original support thread:

And here is the URL in question: hidden link

I’d love to know how to make these columns sortable again by the total size of the number instead of the first digits displayed.



Since it is a custom codes problem, please provide a test site with the same problem, also point out where I can edit your custom PHP codes, I need to test it in a live website, thanks


Thanks for the details, I can log into your website, will update here if there is anything found


Here are what I found, in this website, your database is using $table_prefix "wp_pf_", so the old PHP codes won't work.

I have done below modification in your website:
Edit the your theme file "functions.php", replace the PHP codes as below:

function func_orderby_asking_price( $orderby ) {
	global $WP_Views, $table_prefix;
	 if($WP_Views->current_view == 907){
		 $orderby = str_replace( $table_prefix . 'postmeta.meta_value', "cast(replace(trim( leading '$'  from " . $table_prefix . "postmeta.meta_value),',','')  AS UNSIGNED)", $orderby );
    return $orderby;
add_filter('posts_orderby', 'func_orderby_asking_price' );

Please test again, check if it is fixed, thanks


My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.