Hello! I am a software engineer but am new to WordPress and am helping an organization with some software/IT related issues by donating my time. I am helping the organization embed a custom form on their website to handle donations.
At present, there are dozens of plugins installed and the WordPress theme/template was built-off of another organization’s site.
What I have attempted:
1) In `Appearance -> Theme File Editor -> Theme Functions (functions.php)`, I have added the following line:
“`
add_filter(‘acf/settings/remove_wp_meta_box’, ‘__return_false’);
“`
This is to disable the Advanced Custom Fields plugin from disabling the built-in WordPress Custom Fields feature such that the Code Embed plugin can work.
2) After the above, in my test page, I enabled Custom Fields by selecting Screen Options in the top and then checking the Custom Fields checkbox.
3) In the Custom Fields metadata section inside my test page, I defined two custom fields: `CODE1` and `CODE2`. The `CODE1` field value contains `<div class=’…’ id=’…’></div>`. The `CODE2` field value contains `script src=’…’></script>`. Then, in the page content, I use `{{CODE1}}` and `{{CODE2}}`. From here, the [Code Embed plugin]) should handle inserting the code into the webpage.
This all *seems* to go well, but the form does not show up. When I view the page source, I see that the `CODE1` content of the `<div>…</div>` shows up, but the `CODE2` content does not show up in the source.
My suspicion is that somewhere in the WordPress settings, configuration, and/or a plugin, something is stripping out the `<script>` tag. Can someone point me to where this could be occurring? I have searched, but I have thus far been able to figure this out.
(As you know, this can be complex. For example, it took me a while to figure out why the built-in Custom Fields wasn’t showing up until I found it was explicitly blocked by the Advanced Custom Fields Plugin.)
Thank you for any help! It will be greatly appreciated!
**************
Edit: I have also tried using the Raw HTML and Raw HTML Snippets plugins through the “Manage Raw HTML Snippets” page to try and insert the script via shortcodes. I defined a custom HTML snippet for my form’s script. The story is the same since the `div` makes it through but something is removing the `script` tag. Is this a permissions issue? A plugin issue? A settings issue?
I have noted the [unfiltered_html]) capability. I am an administrator, but I am not sure if they are using WordPress Multisite or not. If they are, then only the Super Admin gets the `unfiltered_html` capability.
As far as I know, you can’t put JS or PHP or anything like that in the default WordPress custom fields as it strips it all out for security reasons (just like the editor itself). I believe you’ll need to add your script tags as either a shortcode, in a custom template, a custom enqueue, or ugh, installing a plugin to allow you to add JS/PHP code to pages.