Situation: There is a custom post type that is calling the gravity forms shortcode, [gravityform id="1" name="Event Registration Default" title="false" description="false"], to display a form on the page. This custom post is being called by an ajax request to admin_ajax.php and dynamically replacing a portion of the current page.
Problem: Because admin_ajax.php is the actual file that is requesting the content of the post and running the shortcode for the form via $content = apply_filters('the_content', get_the_content());, the form is being displayed in admin more when placed on the page. Form is disabled, admin icons and markup are being shown.
Temporary Solution: adjust gravityforms.php to check if the requesting page is admin_ajax.php and set "IS_ADMIN" = false.
if(!defined("IS_ADMIN") && RG_CURRENT_PAGE != 'admin-ajax.php')
{
define("IS_ADMIN", is_admin());
}
else if (RG_CURRENT_PAGE === 'admin-ajax.php')
{
define("IS_ADMIN", false);
}
i would like a better solution so that when upgrading gravityforms plugin I do not need to remember to make this edit within the plugin.