CIviCRM is incompatible with WordPress "Block Themes" because Javascript is broken by `wptexturize()`
Certain components (in my case civicrm) embed some inline js into form templates, however some part of wordpress or civicrm picks this up and tries to html escape the content, meaning any code snippet using AND (&&
) will not work.
The specific bug we ran into was with CiviContribute: when allow other amounts is ticked the code
// Putting these functions directly in template so they are available for standalone forms
function useAmountOther() {
var priceset = 'price_2';
for( i=0; i < document.Main.elements.length; i++ ) {
element = document.Main.elements[i];
if ( element.type == 'radio' && element.name == priceset ) {
has the last line turned into if ( element.type == 'radio' && element.name == priceset ) {
, meaning the whole snippet fails to load and so selecting/clearing the other amount field doesn't work properly.
I cannot recreate this on the wordpress demo site, as it uses caldera forms. Our workaround was to embed the JS snippet to the bottom of the CiviCrm page, however this is not ideal.
Wordpress 6.0.2, CiviCRM 5.53.0