Questions tagged [date]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
21 views

How do I change the datetime format from ( 'y-m-d' ) to ( 'd m y' ) [closed]

I have code that finds the date a page was last updated: <?php global $wpdb; $psm_mod_datetime = $wpdb->get_var("SELECT post_modified FROM $wpdb->posts WHERE post_title = 'Current ...
0 votes
0 answers
19 views

Get post publishing date from within custom HTML block

I am using a custom HTML block to create a customized title cover for a post on my WordPress site. I would like to get the current post publication date (rather than hard-coding it in and having to ...
0 votes
0 answers
26 views

Update existing post dates to random dates and time

I found this solution but it's now not working now (I am getting a fatal error), can anyone please update the code so its works with WordPress 6.1 (Original Post: Update existing post dates to random ...
  • 1
0 votes
0 answers
24 views

Post date automatically +100 years into the future

Thank you for taking time to read my questions as I understand the request is a bit odd. Currently I am doing posts in the Sci-Fi genre and would like the posts to come out reading 2122 instead of ...
  • 1
0 votes
1 answer
20 views

Bulk Updating Post Date in 1 day Increments

I have 1700 Motivational Updates + Write ups imported to WordPress. The problem is they are all published on the same date. I'd ideally like for them to be published once per day. I researched a lot ...
0 votes
0 answers
30 views

wordpress built-in Jalali date convertor

I'm developing a new plugin for a client and he wants dates to be in Jalali. As I changed language of WordPress to Persian, the posts date automatically changed to Jalali. So I Think maybe WordPress ...
  • 101
2 votes
1 answer
42 views

Convert GMT time to local time in Gutenberg Block Editor

I'm wondering if I can use any of the functions listed in the @wordpress/date package to convert a GMT date to a date in the user's locale. For example, this GMT datetime 2023-06-20 17:46:00 would be ...
  • 23
0 votes
0 answers
30 views

date format of custom date variable

So i have this wp product query to get some products. and i want to sort by date, but i want to change the date format of this variable to yyyy-mm-dd. How should i go about doing this? Thanks in ...
0 votes
0 answers
26 views

Is there way to toggle the publish date display?

I am interested in changing our WP dashboard so that I can choose whether an individual Post will include the publish date or not. Is there a way to do it without a plug-in and insert code that maybe ...
1 vote
0 answers
13 views

Mini app that shows one unique quote each day. 56 rotating posts rotating for each themed weekday. It works, but I need your advice

Let's say I have 365 posts published in 2022. I have 56 posts for each weekday (each weekday has a different theme). Normally, if I were to publish them in order, the 1st Monday post would be ...
0 votes
0 answers
16 views

Include last post date in get_categories loop

I have a simple get_categories loop on a template page which works fine to display a list of categories within the parent category 52 (as shown below). I would like to also display the last post date ...
  • 1
0 votes
0 answers
36 views

How to sort WP_Query by a custom text field (written as a date dd/mm/yyyy)

I have an ACF text field for a CPT that is holding a date in DD/MM/YYYY format (it's a text field and not a datepicker field as the data was imported from a CSV file). My Wordpress loop then sorts by ...
  • 3
1 vote
1 answer
157 views

How to add a sortable date column in an admin page?

I'm trying to add a date column to an admin table (to woocommerce order page, just to be specific, but this code is not plugin dependent). The code works for adding the column, but whenever I try to ...
0 votes
1 answer
104 views

If Post Published Date or Modified Date is 1 Year or Older, Display Notice on Post Page

I need a way to inform visitors if the post published date or modified date is older than 1 year and if so, display a message on the post page. I have added an code to my content-single.php file, but ...
1 vote
0 answers
53 views

How to change post published date to today date with SQL

How to change already published post date and time to current date and time using SQL. I have a solution for the year but I don't know how to change the completion date to the current date and time. ...
0 votes
1 answer
46 views

Is it possible to change X Hours Ago to date in WP Admin?

Is it possible to change "X Hours Ago" to date in WP Admin? Edit: This seems to work except for one thing. It says the date fine, but then it says " ago" so it shows "Feb 16, ...
0 votes
1 answer
29 views

Converting Y-m-d to a date with a Month name? [closed]

So I can easily get today's date with: echo (date("Y-m-d")); The above outputs: 2021-12-06 How do I get 2021 December 06 from the above format? P.S. I will be storing 2021-12-06 into my ...
  • 203
0 votes
1 answer
302 views

How to change the date and time in REST API for comments?

/** * Add a Formatted Date to the WordPress REST API JSON Post Object * */ add_action('rest_api_init', function() { register_rest_field( array('comment'), 'formatted_date', ...
  • 287
0 votes
1 answer
186 views

How to disable date archives?

Is there a way to disable date archives in WordPress? For example, I don't want to have date archives (example.com/2021/06/11, for example) available at all. Is there a way to turn these archives off? ...
0 votes
1 answer
399 views

Display Current Date using shortcode

I am using the below code to display current date in php using shortcodes for Indian time zones: add_shortcode( 'current_date', 'mth_footer_date2' ); function mth_footer_date2() { ob_start(); ...
0 votes
0 answers
18 views

Check if is Post or Comment

I made a function to display the time since posting an article or comment. function custom_posted_ago() { global $post; global $comment; if ( get_post_type() ) : $object_ID = ...
  • 5
0 votes
0 answers
46 views

Create a date archives template page for custom post type

I'm trying to create a date archives template page, only for dates for custom post type "blog", without success. I have created the following file but WordPress goes directly to archive-blog....
0 votes
1 answer
64 views

If X Amount of Time Has Passed Since Post Was Published, Do Something

if ( human_time_diff( get_the_time( 'U' ), current_time( 'timestamp' ) ) < strtotime( '7 days' ) ) { echo 'New!'; } I've also tried: if ( get_the_date( 'U' ) > strtotime( '-7 days' ) ) if ( ...
's user avatar
0 votes
1 answer
701 views

How to get User Time Zone in Wordpress?

how can I get user Time Zone in Wordpress if you don't know where the user comes from. Let's say if a user is in USA I need to get USA Time Zone, if the user is in Germany I need to get Germany Time ...
  • 101
0 votes
0 answers
25 views

How to set post date in post_type so that it's same as latest post in category

I have post_type called 'series' and posts with sharing category as attachment. The problem is when I create list using post_type by date, the date follows post_type post date and not latest 'post'. ...
  • 3
0 votes
1 answer
261 views

SELECT rows between two datetimes when the range is dynamic [closed]

I'm trying to select rows that fall into a certain date range from my database table. The range is determined dynamically by the user. In my database I have a column called "dateAndTime". It ...
  • 117
0 votes
1 answer
48 views

User set date and time from frontend doesn't get stored into database

My application lets users store diary entries into a database table. They are free to set the date and time to what they need using html inputs (so I can't simply use the current time because they ...
  • 117
0 votes
1 answer
91 views

Display Author Registration Date

In author archive, I want to show author registration date in the following format: January 16, 2021 I have found this code: $user_ID = $post->post_author; echo the_author_meta( 'user_registered',...
0 votes
0 answers
43 views

Change Old Wordpress Post Date Year

I have old WordPress posts that were published way back in 2017, 2018, and 2019. I would like to republish this content. Basically, what I want is that all content from 2017 to be republished in 2021, ...
0 votes
1 answer
109 views

Display post count for a specific month

I am trying to display post count for a specific month, But something is wrong with my query because count is wrong. here I want to get post count for Aprel month. Can anyone help me please ? Thanks ...
0 votes
1 answer
13 views

Issue in displaying the ongoing event and current events in the post

I am developing a consultancy website which has event to it. I am using ACF for generating event Firstly the event consists of 3 things, Past Events Ongoing Events + current events + upcoming events ...
0 votes
2 answers
124 views

Get current user last post date

So i need to get and echo current users last post date. What i have researched and tested. Red article here: https://developer.wordpress.org/reference/functions/get_most_recent_post_of_user/ Red this ...
  • 47
0 votes
1 answer
172 views

Change date format

I am using wordpress for an integration with an recruitment software. Now i am having an issue with an 'endDate' slug. The date format seems to show up as yyyy-mm-dd. How can i change this format to ...
  • 3
0 votes
0 answers
23 views

My website is showing today's date instead of published date since db migration to a new wordpress

I exported my database and content to a new Wordpress. Everything works fine, except that every post is showing under today's date, instead of the published date like it should be (the actual ...
  • 1
0 votes
1 answer
75 views

How can I change the date format of the revision list?

The date format looks like this "$ datef = _x ('F j, Y @ H: i: s', 'revision date format');" but I want it to be like this "$ datef = _x ('Y-m-d @ H: i: s', 'revision date format');&...
0 votes
1 answer
16 views

Not work hide comments with future date

My code not work. How to correct code? function filter_where( $where = '') { $where .= " AND wp_comments.comment_date < '" . date('Y-m-d H:i:s') . "'"; } add_filter( '...
0 votes
1 answer
317 views

Translate Post date (month) of china language

How can I translate with the date output format like this: AUG 2020 with php wp or my wordpress site is currently using the polylang plugin. Please help me, thank you.
  • 3
0 votes
1 answer
93 views

How to apply CSS based on publishing date

Is there an idea in WordPress that can apply CSS file only to posts published after a certain date? Renewal a site created with WordPress. It is to keep the previous record and apply the design ...
0 votes
1 answer
109 views

Local Post Date in Wordpress Admin Panel Tables

It seems that Wordpress does not save the post date in UnixTimeStamp in the database, and it comes up with the whole date and time format, as we can see in the image below. With this introduction in ...
  • 113
1 vote
0 answers
12 views

Events are all showing the current date

I have installed lately the ACF plugin by Elliot Condon to manage my posted events on my website, I've put inside the WP_Query array the following: <?php $today = date('Y-m-d'); $homepageEvents = ...
0 votes
1 answer
55 views

How can I tranlslate post date in italian?

I'm using this filter to display post date in my single and archive pages, because working on a windows azure php app I can't show post date before 1901. This filter is working but It displays post ...
0 votes
1 answer
188 views

Display date and time into post edit comments section

My users need to see the date and time for each comment from the post edit page. Can anyone help me to display these metadata please? Edit: When editing a post (cpt in my case) you can see the ...
1 vote
1 answer
25 views

Ordering posts by publish date not working?

My site has a "Portfolio" page, which pulls in posts in category 3. Here is my code which selects the posts: <?php $args = array('cat' => 3, 'post_type' => 'post', ...
0 votes
1 answer
2k views

Archive filtering posts by year and month

I want to create a date archive were all the existing years containing posts are appearing in a list, together with another list containing the 12 months of the year. Essentially it would be like this:...
  • 19
0 votes
2 answers
459 views

Get users based on month ACF datepicker field

I have an ACF field 'date_of_birth' which stores the user's birthday, examples: 20201226, 20151225, 19980701 Goal: get all users which have their birthday this month, or next month. I currently have ...
0 votes
1 answer
62 views

Ordering posts by anniversary using only day and month

I defined a custom field named crimedate using standard date format Y-m-d. I defined the filters to make ordering by this date work in the post list of the backend, which works fine. Now I need the ...
  • 145
0 votes
1 answer
204 views

Ordering posts by custom field named "date" in backend

I defined a custom field named "date" and now want to order the post list in the backend by this field. I defined the filters to make ordering work and header is clickable and shows the ...
  • 145
1 vote
0 answers
23 views

How do display most popular post from a year earlier to the day?

I'm trying to display a post that was the most popular a year ago on the day it was posted. So today would be October 12, 2019. I would like to base it off of this: functions.php: function ...
  • 247
1 vote
1 answer
146 views

wordpress convert timestamp to date not correctly

I use wp_date() function to convert and show dates with hours and minutes. wp_date( 'Y/m/d - H:m:s',1598205923, 'Asia/Tehran' ) My problem is it shows Y/m/d correct. the hour is ok. but it shows m:s ...
  • 191
0 votes
0 answers
92 views

Wordpress wrong dates bug

I am using Wordpress version 5.4. I have a problem with the dates in a CPT, and it is that the dates show one day less. Example: If I put in the backend the date, 08/18/20, in the frontend it shows me ...

1
2 3 4 5
11