Ready to get started?Download WordPress


Using get_headers in WordPress (2 posts)

  1. jweikelinteractive
    Posted 3 years ago #

    I'm trying to access the 'Last-Modified' meta data for a file, however I haven't managed to get it working inside of WordPress.

    Outside of WordPress, this works fine:

    $remoteheaders = get_headers($url, 1);
    echo $remoteheaders['Last-Modified'];

    However, that function won't run inside the WP API. I've seen that there are two WP functions, wp_get_http and wp_get_http_headers, but i haven't gotten either to work.

    Can anyone provide a working example to doing this?

  2. jweikelinteractive
    Posted 3 years ago #

    Nevermind, solved the issue. When working inside the wordpress api, use all lowercase letters. For example, 'Last-Modified' would be 'last-modified'.

Topic Closed

This topic has been closed to new replies.

About this Topic