Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [date]

The tag has no usage guidance.

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

Coding a button linking to an external site that changes monthly

I am updating our website for a Membership based organisation in which I volunteer, and we would like to streamline the sign-up process, which has been essentially totally manual/paper-based until now....
henreetee's user avatar
  • 103
0 votes
1 answer
15 views

How to get total posts count for each date?

function test_dashboard_content() { $args = array( 'posts_per_page' => -1, 'post_type' => array( 'post', 'page' ), 'post_status' => 'publish', 'date_query' => array( 'after' => '...
WPdummy's user avatar
  • 23
1 vote
1 answer
26 views

Many CPT is conflicting of the custom date

How can I fix the date with multiple Wordpress CPT date? An example, the custom post "John The Man" on "Canada" CPT the birthday is "Thursday 05 May 1960". How can I ...
Oldie's user avatar
  • 11
0 votes
2 answers
21 views

how to compare date meta value in jet smart filter Date query?

trying to compare meta value between today and next 7 days, tried this in value field %today%, %str_to_time|+ 1 week% but its not working.
vikram's user avatar
  • 1
0 votes
0 answers
19 views

Is there a way to display date inside a page without using plugins or custom codes?

Is there a way to display date inside a page or post without using plugins or custom code inside functions.php ? for example like using short codes
zac's user avatar
  • 103
0 votes
0 answers
26 views

post_modified = post_date

Not work code, why? function update_modified_date_to_post_date( $post ) { global $wpdb; $wpdb->query("UPDATE $wpdb->posts SET post_modified = '{$post->post_date}', ...
Te43922's user avatar
0 votes
1 answer
23 views

Best Practice for storing aggregate data by date or other criteria?

I'm creating summary descriptions by year. To do this I do update_post_meta on save to set values for word count, image count, external link count. So for a year archive page I iterate over each post ...
artlung's user avatar
  • 3,076
0 votes
0 answers
18 views

How to display only posts from the last day with posts published?

The goal is to show today's published posts or, if there's none, the last day's with posts published posts. I found this old question, but the code suggested uses query_posts. I'd like to use WP_Query....
Rodrigo G.'s user avatar
0 votes
1 answer
99 views

How to change post date and post time in Wordpress automatically with a function

I am not much of a coder but I have done research lately on how to change the post date and time in WordPress to the current date and time for all posts and I have not been able to get much. If anyone ...
tee's user avatar
  • 1
0 votes
0 answers
19 views

WP_Query filtering in ACF field containing dates

I'm trying to use WP_Query to filter Advanced Custom Fields posts that can contain this value in the "dates" field (text type), for example "20230101-20230102;20230201-20230202;20230301-...
jakr's user avatar
  • 1
0 votes
1 answer
48 views

How to get next day date of a specific day

I have created a shortcode in WordPress to show next day date of a specific day but it does not show the correct date when I am passing the parameter through the shortcode. Can anyone tell me what I ...
v morgesh's user avatar
1 vote
1 answer
69 views

Gutenberg DatePicker component with time set to zero

I'm using the following code to get and set a date meta value for a CPT in Gutenberg (some code omitted for brevity): const [meta, setMeta] = useEntityProp( 'postType', 'activity', 'meta' )...
leemon's user avatar
  • 1,918
0 votes
1 answer
51 views

How to get orders that contains a product by date?

I want to get the orders that contains a specific product ID by date. But the result is empty w<hile it should'nt. Ideally i need to send only the MONTH in $order_date to get orders by MONTH ...
Pipoo's user avatar
  • 49
0 votes
0 answers
141 views

Issue with Date Picker Field Type

While working on a project, I encountered an issue related to the date picker field type. Specifically, I am creating a custom field for date selection using a date picker. However, upon selecting a ...
Abhijeet Kumar's user avatar
1 vote
2 answers
61 views

How to display *block number* instead *date value* on Wordpress posts?

Ideally, the goal is to show the block number (ie: 782667) instead of the date value (ie: 26 March 2023 4:44PM CT) on all wordpress posts and pages that currently display it. There's maybe a script we ...
SuperAtic's user avatar
  • 149
0 votes
1 answer
219 views

WP_Query sort by ACF date field (newest first) with blank dates first

I have a custom date field that is optional. If a date is not provided, the item should be first in the items returned by WP_Query. Example: 1st: entry with no date 2nd: entry with date 1 March 2023 ...
Space's user avatar
  • 129
0 votes
4 answers
46 views

How to customize Date Format for American visitors?

Basically, I just want the format to be mdY if an American / US Resident is using the site, and dmY for everyone else. Right now, the only way I see I can do this is changing it via radio buttons. Is ...
QRIOS WORLD's user avatar
0 votes
1 answer
758 views

Convert custom field date format to "Wordpress default"

Hello ladies and gents, I'm using F j, Y (e.g. December 28, 2022) as default date format on my site (set in the admin settings). I have an event custom post type with an event_start_date custom field. ...
nomade0's user avatar
  • 27
0 votes
1 answer
177 views

Change Post status based on custom field date +1 day

I have a working script to "expire" a post based on the data of a custom field. The post "expires" (status changes to a custom status archived) on the same day as the ...
nomade0's user avatar
  • 27
0 votes
1 answer
92 views

how show post date for specific post?

i want to show specific post date into my theme not in single.php for example i want to show published date into this : <ul id="post"> <a href="https://www.example.com/ps" ...
Hamoon's user avatar
  • 1
1 vote
1 answer
1k views

Is it possible to specify a time interval (from, to) in ACF with date picker, or other custom field?

I am working on an online magazine in WordPress PHP (with Advanced Custom Fields plugin). I specify the date of the article's publication with 'date picker' field. Even though for articles ...
Curious Programmer's user avatar
0 votes
1 answer
319 views

wp_date doesn't work

in my original code the date was wrapped with date_formatted. my website is bilingual so i need to localize date format and name of months etc. i've changed it with wp_date but it does not work. the ...
okan şahin's user avatar
0 votes
1 answer
206 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 ...
Cynthia A Lockley's user avatar
0 votes
0 answers
67 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 ...
Jason O's user avatar
0 votes
0 answers
135 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 ...
Mi2's user avatar
  • 11
0 votes
1 answer
146 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 ...
user1595112's user avatar
0 votes
0 answers
257 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 ...
Mohsen35's user avatar
  • 101
2 votes
1 answer
138 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 ...
David M's user avatar
  • 23
0 votes
0 answers
34 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 ...
bfoley_teamug's user avatar
1 vote
0 answers
16 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 ...
Studious Programmer's user avatar
0 votes
0 answers
147 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 ...
CuCo's user avatar
  • 3
1 vote
1 answer
944 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 ...
Sasha Grievus's user avatar
0 votes
1 answer
515 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 ...
Marcus Wood's user avatar
1 vote
0 answers
123 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 whole date to the current date and time. UPDATE ...
Puneet's user avatar
  • 47
0 votes
1 answer
129 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, ...
Digital Lion's user avatar
0 votes
1 answer
2k 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 ...
robert0's user avatar
  • 203
0 votes
1 answer
705 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', ...
Johan's user avatar
  • 309
0 votes
1 answer
1k 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? ...
Aaron Bentley's user avatar
0 votes
1 answer
2k 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(); ...
Amresh Mishra's user avatar
0 votes
1 answer
135 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 ( ...
user avatar
0 votes
1 answer
2k 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 ...
Besart's user avatar
  • 101
0 votes
0 answers
32 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'. ...
Guruh's user avatar
  • 3
1 vote
1 answer
992 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 ...
Antti's user avatar
  • 127
0 votes
1 answer
153 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 ...
Antti's user avatar
  • 127
1 vote
1 answer
218 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',...
Morshed Alam Sumon's user avatar
0 votes
0 answers
55 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, ...
Chachii's user avatar
0 votes
1 answer
318 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 ...
Gidromasservis QSC's user avatar
0 votes
1 answer
18 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 ...
Jhyaps's user avatar
  • 1
0 votes
2 answers
422 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 ...
ANdy's user avatar
  • 47
0 votes
1 answer
757 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 ...
Mo Bo's user avatar
  • 3

1
2 3 4 5
11