PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-a.7
Jetpack – WP Security, Backup, Speed, & Growth v16.3-a.7
16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 All 506 releases
← All changes | modules/copy-post.php +3 -3 16.2 → 16.3-a.7 View file →
@@ -274,9 +274,9 @@
274 274 * @param WP_Post $source_post Post object being copied.
275 275 * @param int $target_post_id Target post ID.
276 276 * @return array Modified post data.
277 277 */
278 - public function copy_footnotes( $data, $source_post, $target_post_id ) {
278 + public function copy_footnotes( $data, $source_post, $target_post_id ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable -- Kept for backward compatibility.
279 279 $footnotes_json = get_post_meta( $source_post->ID, 'footnotes', true );
280 280
281 281 if ( '' === $footnotes_json ) {
282 282 return $data;
@@ -310,10 +310,10 @@
310 310 $data['post_content'] = str_replace( 'id="' . $old_id . '-link"', 'id="' . $new_id . '-link"', $data['post_content'] );
311 311 $data['post_content'] = str_replace( 'id="' . $old_id . '"', 'id="' . $new_id . '"', $data['post_content'] );
312 312 }
313 313
314 - // Save the footnotes meta with new IDs.
315 - update_post_meta( $target_post_id, 'footnotes', wp_json_encode( $footnotes, JSON_UNESCAPED_SLASHES ) );
314 + // Saved by wp_update_post() in update_content(), which slashes $data to match update_post_meta()'s unslashing.
315 + $data['meta_input']['footnotes'] = wp_json_encode( $footnotes, JSON_UNESCAPED_SLASHES );
316 316
317 317 return $data;
318 318 }
319 319