How to update the 'modified_time' of a post ONLY when content is changed?

For some reasons I show the Last Modified information to my users in the blog. Recently I have to clear up my categories and tags, but these actions will result in the update of 'Last Modified' field of a post, which is not actually I desired. Content updates are what readers really concerned about, and not about meta information (like tags, categories, custom fields, descriptions, etc). So is there a way to update the 'Last Modified' field of a post …
Category: Web

Enabled Revisions to existing custom post type not working Wordpress

I am trying to enable revisions for an existing custom post type. As the post type was already created about 2 years ago so where the post type was register I added revisions to the supports array. Earlier my code was like: $labels = array( 'name' => 'Products', 'singular_name' => 'Product', 'all_items' => 'All Products', 'add_new' => 'Add New', 'add_new_item' => 'Add New Product', 'edit_item' => 'Edit Products', 'new_item' => 'New Product', 'view_item' => 'View Product', 'search_items' => 'Search Products', …
Category: Web

post visibility history

Revisions show past versions of the article/page but is there a way of seeing the Visibility status historically? User A publishes User B edits the published page changing the visibility to something like private Is this reflected anywhere in the history/revisions?
Category: Web

Displaying a List of Changes / Updates on the Website Publicly

I was wondering if there was some way to display / track down the recent changes for the pages (and possibly posts). I mean, showing "admin updated "x" page Jan. 15, 2022 3pm". Something like my old site. This is the current site. Maybe I'm asking too much but I also would like to reflect what was exactly updated as well. I must clarify that I don't want this to be only seen internally, I want it to be shown …
Category: Web

Getting 401 unauthenticated error in WP Rest API revisions

I'm trying to fetch preview data through WP Rest API using a url such as /wp-json/wp/v2/pages/1140/revisions/1653. An extra header is also included: 'X-WP-Nonce': <nonce> - nonce comes from WP. Why am I getting 401 unauth error? Thanks { code: 'rest_cannot_read', 2020-07-21T11:45:35.930292+00:00 app[web.1]: message: 'Sorry, you are not allowed to view revisions of this post.', 2020-07-21T11:45:35.930293+00:00 app[web.1]: data: { status: 401 } }
Category: Web

Why my wp_posts data is so huge?

My WordPress has only 23 posts but the wp_posts data is over 70MiB. Is it the average size? The Posts I have were created with WPBakery Visual Composer and has 10 revisions. However, I deleted all the revisions with Revision Control but the wp_posts data size has no change. --- update info on Apr 22, 2016 @ 12:12pm -- I found the wp_posts data it has over "60000+" rows of data. -- update info on Apr 27th 2016 @ 5:02pm …
Category: Web

Revision featured image

In WP revision i can not see if i upload featured image and update post. WP revision save just content, heading and excerpt. I have problem with some employs, they said that uploaded image and we do not have that in Database. How can i see in revision or in database if someone upload image on post and update post?
Category: Web

Problem with revisions only returning four results

I have the following query running to grab post revisions to show specific data on the front-end to users... $postType = 'items'; $metaKey = 'price'; $query = " SELECT c.meta_value,post_modified FROM wp_posts a LEFT JOIN wp_term_relationships b ON (a.ID = b.object_id) LEFT JOIN wp_postmeta c ON (a.ID = c.post_id) WHERE a.post_type = %s AND c.meta_key = %s order by post_modified DESC "; $metaValues = $wpdb->prepare($query, [$postType, $metaKey]); $metaValues = $wpdb->get_results($metaValues); Once the data is gathered, it only seems to return …
Category: Web

Do multiple revisions really slow down WordPress?

I have read numerous times that I should clean up my database to keep performance high. Keeping multiple revisions of posts is always cited as a big performance stealer. I'm suspicious of this claim. I get that the table will be significantly larger with 10 revisions than 2, but will it really be slower in operation? Given that there are indexes (or should be) on the fields you look things up on frequently, queries should still be nearly as quick. …
Category: Web

Show history of post revisions on front end

I'm working on an internal knowledgebase and I want to show the post history on the front end (with something like author, date and difference). I first landed on wp_get_post_revision() (https://developer.wordpress.org/reference/functions/wp_get_post_revision/) and after more searching I found wp_list_post_revisions() (https://developer.wordpress.org/reference/functions/wp_list_post_revisions/) which looks closer to what I want. However, while messing with this I'm running into errors while updating posts (Updating failed. The response is not a valid JSON response.) and I don't see anything on the front end when I return …
Category: Web

Woocommerce altered my homepage, and I can't figure out how to revert it

(I'm not sure if this is specific to Woocommerce or not, since the solution may be a general Wordpress process.. if it is I will delete and move to the wordpress forum) I added Woocommerce to an existing site with the Astra theme. My site already had a nice homepage. The shop was to be reached from a menu. Woocommerce installed fine, and I decided to configure its settings. It quickly prompted me to create a 'custom homepage', and I …
Category: Web

Display post changelog in post

I need to show history of post changes (post revisions) at the end of post content. I saw tips about "Last modified by/date" feature but I need to show the table of all changes (revisions) done on post (Date/author/content- if possible). It's formally required for public institutions and I'm bit surprised there are nothing on Google. Is there a way to do that?
Category: Web

Getting post revision and printing them on the post content site

I trying to print older post revisions on the content.php site (theme: twentytwenty), and this, with staticly set value works.. $query = $wpdb->prepare("SELECT * FROM {$wpdb->prefix}posts WHERE post_type = 'revision' AND post_parent = '6'"); But if I wanted this dynamically for each post it prints me only ID of post and nothing more.. That magic piece of content.php: <?php $post_id = the_ID(); global $wpdb; //$result = $wpdb->get_results("SELECT * FROM wp_posts WHERE post_type = 'revision' AND post_parent = '. $post_id.';"); $query …
Category: Web

How can I change the date format of the revision list?

The date format looks like this "$ datef = _x ('F j, Y @ H: i: s', 'revision date format');" but I want it to be like this "$ datef = _x ('Y-m-d @ H: i: s', 'revision date format');". I don't want to modify the core of wordpress, is there a way to do it with a hook? This is in wp/wp-includes/post-template.php, the function is called "wp_post_revision_title_expanded".
Category: Web

What happens if I delete all the rows that represents a post revision from the posts table into WordPress database?

I have the following doubt related to the posts table of the WordPress database. I see that when I create a new post in this table are automatically created 2 new rows. 32 1 2014-08-16 15:07:22 2014-08-16 15:07:22 TEST REVISION TEST REVISION inherit open open 31-revision-v1 2014-08-16 15:07:22 2014-08-16 15:07:22 31 http://localhost/wordpressAsper/2014/08/16/31-revi... 0 revision 0 31 1 2014-08-16 15:07:22 2014-08-16 15:07:22 TEST REVISION TEST REVISION publish open open test-revision 2014-08-16 15:07:22 2014-08-16 15:07:22 0 http://localhost/wordpressAsper/?p=31 0 post 0 I know …
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.