Map timestamp to WordPress Date
-
Hi,
I’m trying to map the image created date into the field WordPress uses for it’s Date field in the default Media admin page. This is because I am using some other plugins that can only run from that page and it can only search by date.I’m fairly sure the image timestamp should be the mapping source but I am not sure what I should be using as my target field for my mapping ?
Thanks for a great plugin
(ps. would love to see integration with the Bulk Replace Media plugin!)
-
On a related question, what is the format for the Uploaded On date on the bulk update screen? (Assuming this is the same date field used on the ordinary Media screen).
I have tried everything I can think of! ISO date, Japanese format, US format and timestamp?
Thanks for your questions. I do not believe the current MLA version supports the “Uploaded on” date field as a target for a mapping rule but I will investigate further and see if I can add one.
Regarding the Bulk Edit area, all of the formats you have tried should work but I have had a few reports of problems I have not been able to reproduce. Please look at this earlier topic and, if you can, activate the debug logging and try a few experiments:
Bulk editing for the “Uploaded on” returns an ajax.fail error
Thanks for any additional information you can provide.
Well, my plugin is better than my memory. You can indeed define a mapping rule for the “Uploaded on” date field:
- Go to the Settings/Media Library Assistant IPTC/EXIF tab.
- If you want to apply the rule to new items as they are uploaded, check the “Enable IPTC/EXIF Mapping when adding new media” and “Enable IPTC/EXIF Mapping when updating media metadata” boxes.
- Click the “Standard” view to filter the display to the six standard fields.
- Locate the “Uploaded on” rule entry and click the “Edit” rollover action.
- In the “IPTC Value” dropdown control leave the default “- None (select a value) -” in place.
- In the “EXIF/Template Value” text box enter something like “DateTime”, depending on your image file content.
- In the “Priority” dropdown, select “EXIF”.
- In the “Existing Text” dropdown, select “Replace”. This will apply the update to all of the existing Uploaded on values when the DateTime value is present.
- Scroll down to the bottom of the screen and click “Save Changes”.
Once you define a rule you can apply it to a single item, multiple items or all items:
- To map a single item, go to the Media/Assistant submenu and click the thumbnail of the item you want (or click the “Edit” rollover action) to get the Media/Edit Media screen. You can click the “Map IPTC/EXIF metadata” link to run your rules on this item, then scroll down and look at the “Uploaded on” value in the “Save” meta box to inspect the results.
- To map two or more items, go to the Media/Assistant submenu and click the checkbox next to the items you want. Then, select “Edit” from the “Bulk Actions” dropdown above the checkboxes and click “Apply” to open the Bulk Edit area. Click the “Map IPTC/EXIF metadata” button to run your rules on the selected items.
- To map all of your items, stay on the Settings/Media Library Assistant IPTC/EXIF tab and click the “Execute” rollover action for the Uploaded on rule. This may take a while.
- The Settings/Media Library Assistant IPTC/EXIF tab also has an “Execute” Bulk Action you can use to apply several rules at once, and an “Execute All Rules” button to run all of the rules against all of your items.
Regarding your Bulk Edit update failures, I have run some tests and verified that values like “2019/09/30 11:23:45” and “2013:08:15 09:21:56” are working on my system. If you can list some of the actual values that are failing for you I can investigate further.
Hi having recently been down the same path as yourself I’ll share what I learnt (with David’s excellent help too)
I mapped DateTimeOriginal into the ‘uploaded on’ field. There’s other fields like DateTimeDigitised. I used DateTimeOriginal as it is accessible via the standard File Properties dialog in Windows File Explorer – there it is called Date Taken.
I also worked out how to extract the year part so I could load the Att. Tags with the year to enable easier year based filtering of photos using this rule template:([+exif:DateTimeOriginal,date(‘Y’)+]) – it’s the date(‘Y’) that re-formats the date/time string into a 4 digit year.
If you’re interested have a look at my draft gallery – https://cuckoofair.co.uk/new-gallery.
The titles for the photos are built from keywords entered into each photo on my PC. It’s mapping rule is: template:([+exif:Artist+])( at [+exif:Keywords+])( in [+exif:DateTimeOriginal,date(‘Y’)+]). Again these fields were chosen as they gettable at using Windows File Explorer.
Once I’ve uploaded a few more photos I’ll explore the cloud / parameter based filtering. Having put the year into Att. Tag and the details (Performer/Location) into Att. Category I think I’ll be looking to have the user either click a performer (in category) like Princess, The Plonkers and/or a location (in category) like The Maypole, The Bull and/or a year (in Tags).
@cuckoofairweb – Thanks for adding your comments and the details of your application.
I ran another test and I have had success with the following Content Template, which updates the Uploaded on value from the
created_timestamp
value in theimage_meta
array:template:[+meta:image_meta.created_timestamp,timestamp("d/m/Y H:i:s")+]
The format argument may not be necessary (it is the default value) but I added it for clarity. Let me know if this works for you.
Hi,
I still don’t seem to be able to get it do what I am after, maybe it is not available.On the media list page there is a date field (labelled data, i think it is actually post_date). I have added the template to uploaded date as described however the uploaded date is not updating to the timestamp date.
I don’t think I can add a screenshot here or I would attach one.
Timestamp Date Upload Date
April 9, 2014 10:35 am 2019/11/05I have Uploaded On set to
template:[+meta:image_meta.created_timestamp,timestamp(“d/m/Y H:i:s”)+]
Should that update the Date column on the media list page?
Basically what I am trying to achieve is for that column to be able to search based on when the date was taken so that images group correctly – eg. all images taken on April/2014 can be searched using the drop down on top of that page.
Does that make sense?
Thanks for your update with the additional details.
You wrote On the media list page there is a date field (labelled data, i think it is actually post_date). By “media list page” I assume you mean the Media/Assistant admin screen; is that right? I am not sure what “labelled data” means, but there is a column in the submenu table labeled “Date” that is sourced from the
post_date
database column. This field is referred to as the “Uploaded on” date in many parts of the WordPress UI and documentation.By “timestamp date” I assume you mean the
image_meta.created_timestamp
in the attachment metadata array; is that right? You wrote “I have Uploaded On set to” – do you mean the IPTC/EXIF mapping rule? If that’s right, did you set all of the rule elements as I outlined in my earlier post, including “Existing Text” set to “Replace”?If screen shots would help, you can contact me at my web site and I will give you instructions for sending them by email. Thanks for your patience and persistence.
Hi,
I probably should have added that I am using the ACF plugin so the columns may be different. I think though the the Date in the submenu – is a standard field and maps to the WordPress Post date?- This reply was modified 5 years ago by colinrc.
Thanks for mentioning Admin Columns – are you using the free version or the “Admin Columns Pro” version?
Your earlier post included this:
Timestamp Date Upload Date
April 9, 2014 10:35 am 2019/11/05I am not sure where this comes from. If you can click on the link above to go to my web site and send me your contact information I will let you know how to send screen shots. Thanks!
It has been a month since my last post in this topic. I assume you have found a solution for the issue you raised.
I am marking this topic resolved, but please contact me at my web site if I can be of further assistance. Thanks again for you interest in the plugin.
- The topic ‘Map timestamp to WordPress Date’ is closed to new replies.