Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I want to set up a function that notifies me when a core update is available. But i can't find any functions that check for updates.

I have looked at list_core_updates() and it may be possible to check if it returns anything, but i don't know if that is smart.

share|improve this question
add comment

2 Answers 2

up vote 4 down vote accepted

There is get_core_updates().

Note that you might need to manually include admin file that declares it, if running in front end and such.

Example use:

require_once ABSPATH . '/wp-admin/includes/update.php';
print_r( get_core_updates() );

Example return:

Array
(
    [0] => stdClass Object
        (
            [response] => latest
            [download] => http://wordpress.org/wordpress-3.4.2.zip
            [locale] => en_US
            [packages] => stdClass Object
                (
                    [full] => http://wordpress.org/wordpress-3.4.2.zip
                    [no_content] => http://wordpress.org/wordpress-3.4.2-no-content.zip
                    [new_bundled] => http://wordpress.org/wordpress-3.4.2-new-bundled.zip
                    [partial] => 
                )

            [current] => 3.4.2
            [php_version] => 5.2.4
            [mysql_version] => 5.0
            [new_bundled] => 3.2
            [partial_version] => 
            [dismissed] => 
        )

)
share|improve this answer
add comment

An alternative way is to query the API directly via http://api.wordpress.org/core/version-check/1.6/

You can see it buried in there as "current";s:5:"3.4.2"

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.