Opened 8 years ago
Closed 8 years ago
#40495 closed defect (bug) (invalid)
Check objects before getting it's value
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Upload | Keywords: | |
Focuses: | Cc: |
Description
Hi,
I am working with media upload file and noticed one issue with the WordPress core files.
To upload media from folder,
I am using media_handle_sideload() function. But at the time of uploading media, I am getting error of non-object for $wp_rewrite global object in post.php file.
File Path:- \src\wp-includes\post.php file,
there is function wp_unique_post_slug() exists. In this function, feeds have been getting from global object $wp_rewrite.
For refrerence,
$feeds = $wp_rewrite->feeds;
Before getting feeds from global object, it should be checked if object is not empty and feeds are there.
Attachments (1)
Change History (4)
Note: See
TracTickets for help on using
tickets.
Hi @khushbu.padalia and welcome to Trac.
Sorry it took so long for someone to get back to you.
Can you clarify how you're running into this? Are you using your own upload script, or are you running the upload through one of WordPress's upload files?
$wp_rewrite
should be setup and ready before the point at which uploads are processed, if you're processing them yourself I'd suggest ensuring you're waiting until at leastinit
oradmin_init
to process them.