Timeline for Wordpress post_content gets deleted in cron after wp_update_post
Current License: CC BY-SA 4.0
16 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Nov 28, 2018 at 10:40 | vote | accept | Kalizi | ||
Nov 27, 2018 at 16:34 | answer | added | Kalizi | timeline score: 0 | |
Nov 27, 2018 at 16:27 | comment | added | Kalizi | Let us continue this discussion in chat. | |
Nov 27, 2018 at 16:14 | history | edited | Kalizi | CC BY-SA 4.0 |
Found function that triggers the bug, but not the fix
|
Nov 26, 2018 at 17:27 | comment | added | Kalizi |
It's a wp-cron scheduled with wp_schedule_event( time(), 'my_custom_recurrence', 'my_posts_update')
|
|
Nov 26, 2018 at 12:55 | review | Close votes | |||
Dec 11, 2018 at 3:05 | |||||
Nov 26, 2018 at 12:36 | comment | added | Jacob Peattie | When does this code run? What is the hook? | |
Nov 26, 2018 at 11:07 | comment | added | Kalizi |
I used xdebug to debug my code, even with wp_update_post() the post_content gets updated. But when I go to the wordpress post, the content is empty, and it's empty in DB too. I have a clean wordpress installation with Wordpress, Woocommerce and my plugin.
|
|
Nov 26, 2018 at 11:05 | history | edited | Kalizi | CC BY-SA 4.0 |
added 153 characters in body
|
Nov 26, 2018 at 11:02 | comment | added | Jacob Peattie |
When does this code? Do you have any proof that it's running? How do you known the problem is with wp_update_post() , and not that the code just isn't running?
|
|
Nov 26, 2018 at 11:00 | comment | added | Jacob Peattie | Aren't you having the same problem with the version in your question? | |
Nov 26, 2018 at 10:59 | comment | added | Kalizi |
I tried to perform wp_update_post(['ID' => $id, 'post_content' => '...']) but when I refresh the wordpress page, or I select the post_content from the posts table, I get empty post_content.
|
|
Nov 26, 2018 at 10:57 | comment | added | Jacob Peattie | What? Of course it does. | |
Nov 26, 2018 at 10:56 | comment | added | Kalizi |
Because wp_update_post() doesn't update the post_content
|
|
Nov 26, 2018 at 10:30 | comment | added | Jacob Peattie |
Why are you inserting directly into the database and not using wp_update_post() ?
|
|
Nov 26, 2018 at 10:26 | history | asked | Kalizi | CC BY-SA 4.0 |