How to restore post to pending status (no draft)

The official documentation for wp_untrash_post documents a filter for setting the status that it will use: https://developer.wordpress.org/reference/functions/wp_untrash_post/ This filter can be used to return pending instead as the status. If that’s not an option though, you could set the post status to pending after calling wp_untrash_post, it doesn’t have to happen in a single function … Read more

REST API – Retrieving posts with custom status

Yes, authentication is needed, because the Posts endpoint will check whether the current user has the edit_posts capability – see WP_REST_Posts_Controller::sanitize_post_statuses(). Also, a HTTP status of 401 normally indicates that authentication is required. So try again, but with an authenticated request, i.e. make sure the current user is logged-in and has the edit_posts capability.

Can’t publish custom type posts that don’t support title and editor, instead they’re saved as draft

After thorough investigation, I identified the root cause of the issue. TL;DR: A bug in my JavaScript code was causing the post form to be submitted without the necessary publish parameter. Consequently, WordPress interpreted the request as an attempt to save a draft. I resolved the issue by updating the code to include the publish … Read more

editPost without undo entry

Yes, editPost is a wrapper around editEntityRecord which according to the core/data docs takes an options object that supports undoIgnore: options Object: Options for the edit. options.undoIgnore [boolean]: Whether to ignore the edit in undo history or not. While you could use this, generally the need to use it implies a mistake or misunderstanding somewhere, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)