I have a very particular problem. When i do get_post(0); with WP User Frontend it return me the post id 941 which is the post used for the registration page.
In fact, when i upload media it use the year/date of the creation of this post.
How to not get the registration when i do get_post(0); ?
It seems like you’re encountering an issue with the WP User Frontend plugin, where callingget_post(0) returns the post ID associated with the registration page, and this is affecting the media upload behavior.
To avoid getting the registration page when using get_post(0), you might want to consider an alternative approach.
Instead of relying on itget_post(0), you can use theget_posts function with a custom query to retrieve the most recent post that is not the registration page.
The problem is come from the native wordpress version ! When i upload a media it call async-upload.php file and at line 106 it will put post_id 0 :
After media_handle_upload is called, and you have this :
current_time(‘mysql’) function return the year/month from now, but the get_post($post_id) (with post_id 0) return the date from the registration page from wpuserfront end.
This is why all my media go on 2017/05 folder !
How resolve it instead of override WordPress core files?
Thanks
This reply was modified 2 years, 6 months ago by alexbenaim.
This reply was modified 2 years, 6 months ago by alexbenaim.
There is a high chance this could happen due to a plugin or theme using query_posts(). The wp_reset_query() function destroys the previous query and sets up a new one. It should be used after query_posts() and before another query_posts() to remove obscure bugs that occur when the previous WP_Query object is not properly destroyed before another is set up.
I recommend checking for any theme or plugin conflicts on your website. If the problem is not solved, Please contact through the website for further assistance.
Best regards,
Viewing 3 replies - 1 through 3 (of 3 total)
The topic ‘Problem : get_post(0) return me the registration form post’ is closed to new replies.