How can draft post after 1 year

Try this code (maybe working) , but i’am not sure cause not testing : function amin_show_expire(){ global $wpdb; $result = $wpdb->get_results(“SELECT * FROM wp_posts WHERE post_type=”CUSTOM” AND post_status=”publish””); if( !empty($result)) foreach ($result as $a){ $show_time = get_the_time(“Y-m-d”, $a->ID ); $show_time=date(“Y-m-d”, strtotime(“+1 years”, strtotime($show_time))); if ( $show_time < date(“Y-m-d”)){//compare 1 year after post with current time … Read more

Trying to get custom post type attachment images to function in indexed array

Managed to find a solution that display the array correctly: $attachments = get_children( array( ‘post_parent’ => get_the_ID(), ‘post_type’ => ‘attachment’, ‘numberposts’ => -1, ‘post_status’ => ‘inherit’, ‘post_mime_type’ => ‘image’, ‘order’ => ‘ASC’, ‘orderby’ => ‘menu_order ASC’ ) ); $imgArray = array(); $counter = 0; foreach ( $attachments as $attachment_id => $attachment ) { $imgArray[$counter] = … Read more