For post preview, a way to filter metadata value (like save_post hook)
-
Hi,
For some post i have some metadata array with names like:
foo[0][extra][title]
foo[1][extra][title]
foo[2][extra][title]When the post is saved, data is serialized to JSON.
It’s work well, except for preview with “foo” in revision field.i get the error:
Warning: trim() expects parameter 1 to be string, array given in /.../wp-includes/formatting.php on line 4627 Call Stack # Time Memory Function Location 1 0.0015 447728 {main}( ) .../post.php:0 2 0.1322 8584392 post_preview( ) .../post.php:272 3 0.1326 8589312 wp_create_post_autosave( ) .../post.php:1741 4 0.1356 8640896 normalize_whitespace( ) .../post.php:1680 5 0.1356 8640896 trim ( ) .../formatting.php:4627
I have this warning and a new revision is always created because the last saved “foo” data is in JSON and the “foo” data for preview is not filtered and stay an array. I have reading the code but i see no way to apply the same filter “save_post” like i do for the insert and update post.
I have missed something or i submit a patch for doing this thing ?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘For post preview, a way to filter metadata value (like save_post hook)’ is closed to new replies.