frm-stats type=total not calculating when field name has ampersand(&) in it

By: Chad Meinertz | Asked: 11/03/2022
ForumsCategory: Code Helpfrm-stats type=total not calculating when field name has ampersand(&) in it
Chad Meinertz asked 1 year ago
Here's the code I have in a view to calculate a total...
[frm-stats id=531 type=total 419="[419]" decimal=2 dec_point="." thousands_sep=","]
the 419 field is a "Group Name" field and the groups that have an ampersand in the name are not calculating. For example "FAITH FREE & LUTHERAN"

I've tried the sanitize-url( on the 419 field but that broke all the calculations. Also replaced "[419]" with "FAITH FREE & LUTHERAN" and that works I get a total but the total is only for that specific group.  I need this to be dynamic. It appears that when the view is created it converts the ampersand to something else or removes it so it doesn't match anymore and the frm-stats filters out everything, returning no total.  How can I get the "[419]" to return the correct value? I've also contacted support.  They have identified this as a bug, but they suggested asking the community for any help on this. Any help would be much appreciated.
1 Answers
Bobby Clapp answered 1 year ago
If you post simply [419] in a view, does it return back exactly that (FAITH FREE & LUTHERAN)?
Chad Meinertz replied 1 year ago


Bobby Clapp replied 1 year ago

Maybe for now try 419_contains=[419]? If that doesn’t work, best wait out the big fix.

Chad Meinertz replied 1 year ago

Thanks for the idea, unfortunately I tried that and it didn't work. I was wondering if there was maybe a hook ( that could help, but there are so many I'm not sure where to begin.

Rehban Khatri replied 1 year ago

Hello, How did you manage to fix that? Or you were'nt able to?
@Bobby Clapp , Do you know if there is going to be any updates to get this fixed? My client is using a pro version on a production environment and facing issues due to miscalculations on field values with '&'
Any help would be appreciated.

Bobby Clapp replied 1 year ago

Someone needs to bug it with the official Formidable support team.

Chad Meinertz replied 11 months ago

I got a response from the support team. They provided a hook...

Our lead developer shared a hook that can be used to fix this issue. (please add the code below to your site). This snippet you can change the where value used for a stat shortcode. The shortcode value gets encoded so & is really & so it fails the check. This snippet changes all of those & back to & for the query:

function( $where ) {
$where['where_val'] = str_replace( '&', '&', $where['where_val'] );
return $where;

You can put the code in the WPCode plugin, your own plugin, or your theme's functions.php file. I recommend you put it in the WPCode plugin, which has some nice features and will allow you to retain the functionality even if you change themes.

You can read about this in our documentation here:

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community