Code Reference Media Question
-
Hi, I was reading https://developer.wordpress.org/reference/functions/wp_get_media_creation_timestamp/
Is this what I need to learn to put date and time stamp under all media library “link to file” links? I need it to upload each time the media file is updated or replaced.
Updated: Do I change false to true?
wp_get_media_creation_timestamp( $metadata ) {
$creation_date = false;Thanks
-
This topic was modified 6 years, 2 months ago by
Kimber254.
-
This topic was modified 6 years, 2 months ago by
-
What are you trying to accomplish, the output of the date or the storing of several dates?
The function you mentioned is used to read the file and extract the creation date that may or may not be in the metadata of the file.
Since it is creation date, there can only be one date.The website links are mp3, link to media, type of links. I want under or next to each link a Last Update: Date and Time. These mp3 file are overwritten nearly daily using an overwrite plugin. Each time they are overwritten, I want the new date and time to show up under or next to the media link. I’ve tried everything from shortcodes to attach media to post lists to tables but nothing works right. I wanted to edit the php codes to show the media timestamp but I can’t find a tutorial to help me. Usually I can but not with this. Any advice?
The file update time is not stored, unless you write some code for that. But you can get the timestamp from the file, which slows things down a little bit. It would look something like
filemtime( $Path_to_file )
I searched a bit for plugins to help, but found only modified date for posts or file lists with no date.
An old plugin has this code, but it is closed (although you can still look at the code if you need to).@joyously Thank you very much
The topic ‘Code Reference Media Question’ is closed to new replies.