I am currently using Wordpress, and an element of user_registered returns the time of registration of the user. I have set the correct timezone, but don't know how to get the user_registered output to match my current time. So far, this is what I have. date_default_timezone_set('America/Los_Angeles'); $users = get_users(); foreach( $users as $user ) { $udata = get_userdata( $user->ID ); $registered = $udata->user_registered; printf( '%s member since %s<br>', $udata->data->display_name, date( "Y-m-d H:i:s", strtotime( $registered ) ) ); } echo('date below …
In the default wordpress rss feed the element <pubDate> is <pubDate><?php echo mysql2date( 'D, d M Y H:i:s +0000', get_post_time( 'Y-m-d H:i:s', true ), false ); ?></pubDate> and gives a result of <pubDate>Tue, 12 May 2020 12:39:03 +0000</pubDate> how can i change this line to give a result of <pubDate>12/05/2020 12:39:03 +0000</pubDate> (d/m/Y) or <pubDate>12-05-2020 12:39:03 +0000</pubDate> (d-m-Y) but to be valid with RFC-822 ? I tried many variations <pubDate><?php echo mysql2date('r', get_the_time('Y-m-d H:i:s')); ?></pubDate> or <pubDate><?php echo get_post_time( 'd/m/Y …
Does current_time('timestamp') have an issue? I am trying to get the current_time('timestamp'), and instead of giving me my current time: Jun 26 2013 14:30 It gives me: Jun 26 2013 21:30 I tried to check the seconds, and it gives me: 1372282238 Which is correct for the time given, but not for the real current time. What's happening?
I am trying to allow visitors to seek specific times on the embed rumble video inside the wordpress post by clicking to timestamp links. I can do it for youtube videos using Skip to Timestamp plugin or methods like this one however, I cannot make it work for embed rumble videos. I desperately need to make this work for a rumble video. Any help would be greatly appreciated. Cheers.
I am a designer working on a Wordpress website, currently, I need to make a page where there can be displayed an external video (can be from almost any URL) but I want to include some functionality that allows adding links in the text or buttons that actually makes the player go to a specific moment (something similar to Timestamp in youtube videos) in the timeline of the video. Currently, I am using the Elementor pro page builder to construct …
I am trying to perform the following query, which originates by the fact the post's 'date' and 'time' are entered as separate custom fields. $args = array( 'post_type' => 'some_kind_of_posts', 'posts_per_page' => 3, 'orderby' => 'meta_value_num', 'meta_key' => strtotime('date'. ' ' .'time'), 'order' => 'DESC', 'meta_query' => array( array( 'key' => strtotime('date'. ' ' .'time'), 'value' => strtotime(date('H:i',time() + 3600*2)) 'compare' => '<', ), ), ); $query = new WP_Query( $args ); In other words, I need to first combine …
I want to change the term in the custom taxonomy from the set of time intervals. CPT = job, taxonomy = current-status, term = ongoing The below code is not working and I don't know the missing code. Please help me! <?php add_action( 'set_object_terms', 'job_expiration' ); function job_expiration() { //Check the custom post type 'job' if ( is_singular( 'job' ) ) { //get the terms - category $categories = get_the_terms( get_the_ID(), 'current-status' ); //check the term 'ongoing' $term = term_exists( …
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 Zone.
I have an wordpress self-hosted installation that is over 10 years old. I was updating the template files to show the last modified date instead of the published date for my posts. Old snippet: <time datetime="<?php the_time('c');?>"> <?php the_time('j F Y'); ?></time> New snippet: <time datetime="<?php the_modified_time('c');?>"><?php the_modified_time('j F Y'); ?> Here’s where it got weird. Every post that was modified before 6 februari 2021 shows the date 6 februari 2021. Every post that got updated after 6 februari 2021 …
I had to reboot my server due to recurring server errors (which I couldn't find a reason for). Since rebooting, echoing current_time( 'timestamp', true ) shows the time as 14 hours before my current timezone (GMT). As does echoing time(). However, if I go to “Settings > General” in WordPress, the correct time and timezone are showing. This was all working perfectly before the reboot. How do I fix this? I have tried setting the PHP timezone via an .ini …
I look at the debug.log file a lot while developing, and having all the timestamps in UTC drives me crazy! How can I get them to display in local time? I have my php.ini 'date_timezone' value set to 'America/Los_Angeles' already.
I need to change the timeformat in this column to be in hours, not measured in seconds and minutes. This meaning that 30 minutes should be measured in 0.5 hours and so on. I think I need to edit this line of code. Any suggestions on how to change the measurement to ONLY HOURS? return human_time_diff(strtotime($item['time_login']), strtotime($item['time_last_seen']));
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 with a difference of about thirty minutes!!!
I have a short-code that uses PHP to echo a time stamp ala: 1595140137 When I use that short-code as the default post title in new post, the post title changes with each page refresh, and in the browser title area, it just renders the short code characters. I have even double bracketed the short-code. Any ideas? Thanks.
I need to automatically delete the users that are subscribed through a wpforms after 90 minutes of being created. Users created this way are marked as "invitados" on the profile. I found this answer on a previous question: if(!wp_next_scheduled('my_dailyClearOut')) { wp_schedule_event(time(), 'daily', 'my_dailyClearOut'); } function my_clearOldUsers() { global $wpdb; $query = $wpdb->prepare("DELETE FROM $wpdb->users WHERE datediff(now(), user_registered) > 30"); if ($oldUsers = $wpdb->get_results($query, ARRAY_N)) { foreach ($oldUsers as $user_id) { wp_delete_user($user_id[0]); } } } add_action('my_dailyClearOut', 'my_clearOldUsers'); However, this deletes all …
we use the learndash LMS and want to let users get access to lessons everyday at 6am with enrollment based access. For this purpose the LMS stores the enrollment time of every user in the db usermeta table in UNIX. So my question is: How can i change this value to the same date the user enrolled just so the time is 8am but the day stays the same? And how can i run this function shortly after the user …
I´m doing some setting to enable/disable a cron task and choose a time to run this task. When I disable the cron task and enable it after without changed the time, my timestamp is in the past and make this error : WP Control Plugin Result My code function scheduled_task_activation(){ $hook = 'my_hook'; $options_values = get_option( "option_name" ); $is_cron_active = (!empty( $options_values['cron-sync-active'] ) ) ? true : false; $cron_sync_time = (!empty( $options_values['cron-sync-time'] ) ) ? $options_values['cron-sync-time']: "00:00:00"; if( !$is_cron_active ){ …
I have a custom post type with custom metaboxes (as seen on wptheming.com) and would like to make a query to show upcoming events, say in the sidebar, where past dates are left out. But I need a value of the current time to compare with the events start time. Right now i got a current time from current_time('mysql') that looks like this: 2012-02-16 13:15:31 And a start time from the meta that looks like this: 201108121100 How can I …
I'm using this nifty timestamp function that makes the post date "1 day ago" and "five minutes ago" etc. However after a few days I want it to switch to the actual date it was written so for example: January 4th, 2020 at 4:02pm" or maybe just the option to add the time. Here is the code that does x days ago: function meks_time_ago() { return human_time_diff( get_the_time( 'U' ), current_time( 'timestamp' ) ).' '.__( 'ago' ); } <?php echo …
Hi i want to show current taxonomy post type count by month but it show total post count istead of current tax. please help me. i am trying to solve this problem almost 3 weeks. <?php $post_type = "myposttype"; $timestamp_start = strtotime("first day of next month -1 year midnight"); $start = date("Y-m-d H:i:s", $timestamp_start); $posts = get_posts([ "nopaging" => TRUE, "post_type" => $post_type, "date_query" => [ "after" => $start, ], ]); // sort by month $tab = []; foreach ($posts …