As described in this issue, the CiviCRM plugin for WordPress changed in version 5.39 to avoid an issue that some users were seeing, ie the CiviCRM output was appearing twice. This change breaks some sites with various CiviCRM pages only displaying the default CiviCRM WordPress page: "Do not delete this page. Page content is generated by CiviCRM." This plugin reverses this change, so install it if you see this problem.
In CiviCRM for WordPress, the "the_content" filter overwrites the default output with the (cached) CiviCRM output, eg a contribution page HTML.
In 5.39.0, the CiviCRM filter is removed during its first run - see basepage_render()
-
so subsequent calls to get "the_content" do not return the expected output.
This plugin changes the functionality back to pre-5.39.0 by ensuring that the CiviCRM content is returned for every call to the "the_content" filter.
The code in civicrm_539_wp_content_fix_init()
is run when the CiviCRM plugin has completed its init
.
The code removes the CiviCRM "the_content" filter and installs its own ie civicrm_539_wp_content_fix_basepage_render()
.
When this is run, it calls the CiviCRM handler basepage_render()
and gets the CiviCRM HTML.
When run, we may not be on a CiviCRM page, so the CiviCRM HTML is only returned if it is not empty.
Note that the CiviCRM basepage_render()
will try to remove itself as a filter but this will be ignored by WordPress.
You can use the https://github.com/phdccltd/civicrm-wp-content-test test plugin to generate legitimate calls which will cause the 5.39 issue.
Follow these instructions to download this plugin's zip file and then upload via Plugins -> Add new on your WordPress site.
I don't know yet if WordPress will spot any new releases for this plugin.