Set meta field to publish date + 2 weeks

Try this: add_action(‘publish_post’, ‘dp_expiry’); function dp_expiry( $data ) { /*adds 2 weeks onto the current date in unix epoch format*/ $dp_new_expiry_date = (strtotime( current_time( ‘mysql’ ) ) + 1209600); /*converts unix timstamp back to yyyy-mm-dd format like you required*/ $dp_new_expiry_date_conv = date(“Y-m-d”, $dp_new_expiry_date); update_post_meta( $data[‘post_id’], ‘postexpiry’, $dp_new_expiry_date_conv ); }

Adding number to date not working [closed]

your code is not working, because you use strtotime incorrectly… It should be used like this: int strtotime ( string $time [, int $now ] ) But you pass formatted dated as first param, and another string as second one. So how should it look like? Like so: $addeddays = intval( get_user_meta($this->order->user_id, ‘xxx’, true) ); … Read more

Print last modified date only on posts

You can check the post type with get_post_type(). You only want to display the content if the value is post: function wpb_last_updated_date( $content ) { $u_time = get_the_time( ‘U’ ); $u_modified_time = get_the_modified_time( ‘U’ ); if ( get_post_type() === ‘post’ ) { if ( $u_modified_time >= $u_time + 86400) { $updated_date = get_the_modified_time( ‘F jS, … Read more

How to break a date from ACF?

Here you can get separated data from timestamp using date(); function. you can apply different fonts each value. <?php $timestamp = get_field(‘date_time’); $day = date(‘d’, $timestamp); $mon = date(‘m’, $timestamp); $year = date(‘Y’, $timestamp); echo “Day : “.$day.”<br>”; echo “Month : “.$mon.”<br>”; echo “Year : “.$year; ?> if $timestamp value “1567503270” then output will be … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)