Open bobbingwide opened 7 years ago
On a hunch I attempted to reproduce in a local env with Yoast SEO 3.4.2. oik-plugins.co.uk has 3.5. Current latest version of Yoast SEO is 3.7.1
This didn't produce the expected results ( in qw/wordpress). This is most likely due to the fact that cloning had previously succeeded.
So I tried the deactivate oik-testimonials plugin method. The result of this was that the post was cloned to post ID 1. Another rather unexpected result! I manually corrected the id
in the post meta data and tried another clone. It worked. And with oik-testimonials reactivated the cloning continued to work but the result returned contained the unexpected JavaScript
[body] => {"narrative":"blah blah","slave":7975}
<script type="text/javascript">jQuery(document).ready(function() { jQuery( "#bw_testimonial-1" ).cycle( {"width":"100%","fit":1} ); });</script>
<script type="text/javascript">jQuery(document).ready(function() { jQuery( "#bw_testimonial-2" ).cycle( {"width":"100%","fit":1} ); });</script>
<script type="text/javascript">jQuery(document).ready(function() { jQuery( "#bw_testimonial-3" ).cycle( {"width":"100%","fit":1} ); });</script>
<script type="text/javascript">jQuery(document).ready(function() { jQuery( "#bw_testimonial-4" ).cycle( {"width":"100%","fit":1} ); });</script>
Trace output on the server does not show this being returned in the JSON ( see oik_clone_reply_with_json
). But we do see the_content
being invoked during shutdown
processing. The post being processed is the revision 20485.
The hook nesting is:
Analysis of the functions attached to 'shutdown' is enlightening.
/home/oikplugi/public_html/wp-content/plugins/oik-bwtrace/includes/bwtrace-actions.php(426:0) bw_trace_attached_hooks(3) 269 2016-11-02T12:16:36+00:00 0.453553 0.000070 cf=wp_ajax_nopriv_oik_clone_post,shutdown 184 0 10485760/10485760 128M F=629 shutdown
: 0 bw_trace_attached_hooks;9
: 1 wp_ob_end_flush_all;1
: 10 bw_trace_count_report;1
bw_trace_included_files;1
bw_trace_saved_queries;1
bw_trace_output_buffer;1
bw_trace_functions_traced;1
bw_trace_status_report;1
Yoast_Notification_Center::update_storage;1
WPSEO_Sitemaps_Cache::clear_queued;1
Jetpack_Sync_Sender::do_sync;1
Clearly there's a lot going on during shutdown. What I realise is.
It appears that bw_jq_flush() shouldn't be echoing its output in AJAX processing. See https://github.com/bobbingwide/oik/issues/57
For a couple of posts which have been cloned, the ID for a slave's entry has been set to 0. This can happen when the
slave
returned in the JSON cannot be determined due to the JSON being malformed.A particular instance is qw/oikcom/oik-plugins/oik-testimonials, ID 7975, which had failed to clone to oik-plugins.com. The returned JSON includes the JavaScript generated for the [bw_testimonials] shortcode, which was part of the post's content.
This problem does not happen when the post is cloned to oik-plugins.co.uk, nor locally.
Workaround
Disable the shortcodes before cloning and re-enable after. Either edit the code so that it's not expanded or deactivate the https://github.com/bobbingwide/oik-testimonials plugin.
Problem explanation
The problem is caused by 'the_content' filter being run during shutdown processing. See below
Proposed solution
tbc