Get date of last update outside of loop

It is unclear if you are looking for the last updated post or for the last updated date for some particular post. The answer by @PatJ assumes the former. To do the latter: $qry = new WP_Query(array(‘p’=>1)); var_dump($qry->posts[0]->post_modified); Or… $date = $wpdb->get_var(“SELECT post_modified FROM {$wpdb->posts} WHERE ID = 1”); var_dump($date); Of course you need to … Read more

WordPress Posts By Date/Day?

Not a bad idea for display of a blog home page and I would be interested in what you came up with, but thinking through the idea for implementation beyond the first page would be problematic: Pagination – If it is just the blog home then you can easily set an offset for starting on … Read more

Get Recent Posts by Date in Multisite

Since wordpress multisite uses different tables for all blogs, it is very inefficient to get all recent articles of all blogs (content aggregation) on display time since you have to query all blogs, sort the articles by date and display the ammount you need. Plugins like WordPress Post Indexer (https://premium.wpmudev.org/project/post-indexer) additional write all posts into … Read more

Permitting WordPress to accept dates outside of 1902-2038

Hacking the core is never recommended, since you’ll have to reapply your hack every time you update (and for a number of other reasons). The first thing I would normally do is to check if there is a hook or filter to allow you to modify the date. It doesn’t appear there is one. The … Read more

using wp_update_post on save_post

The reason it’s going to be infinite is that every time you save the post, it’s calling change_year…which then calls wp_update_post … which fires the save_post filter. After some review and research, I’m thinking that you should probably avoid the save_post filter. Try using this filter: http://codex.wordpress.org/Plugin_API/Filter_Reference/wp_insert_post_data It gives you really what you want. Here’s … Read more

Display a post’s publish date from 2112

I had the same issue as you when I was dealing with events and wanted to show future events. Here is what I coded: add_action( ‘init’, ‘change_future_posts_to_post_now’ ); function change_future_posts_to_post_now() { remove_action(“future_post”, ‘_future_post_hook’); add_action(“future_post”, ‘publish_future_posts_now’, 2, 10); } function publish_future_posts_now($depreciated, $post) { wp_publish_post($post); } add_filter(‘posts_where’, ‘show_future_posts_where’, 2, 10); function show_future_posts_where($where, $that) { global $wpdb; if(“post” … Read more

Is it possible to Schedule Attachments in WordPress?

My idea is that you can setup a post date for the attachments. This can be done using attachment_fields_to_edit to show the UI (is possible use the touch_time internal function). After that, you can filter all the attachments query to show only the attachments with a past or current date. So add_action(‘load-post.php’, ‘setup_attachment_fields’); function setup_attachment_fields() … Read more

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