Show Outdated Notification In A WordPress Page or Post

What is this outdated notification?

The quick answer is that it is a warning text shown somewhere on the web page that says the article was written on – insert old date here – and the information in the content may be out of date.

This may be kind of redundant when your article has a date published displayed on the page. The idea is to put emphasis to the readers that they may be consuming older content when it may not be so obvious at first glance. It can be more meaningful for published content like a tutorial or how-to article, where you write new ones for more recent versions instead of updating the same post.

So far I’ve mentioned page and post. It can be confusing. In the perspective of WordPress (WP) there are differences. A Post is a different type of published content from a Page. Normally the former is one that is written with a published date associated to it and this attribute can affect the content, sort of like news updates where older ones go down to the bottom. While the latter is meant to be more static, it is there to stay. Pages may contain Posts, but not the other way around. Although, you can convert one to another, and vice versa. There are other content types in WP, but these 2 are the 2 most common ones. Here is a more detailed differentiation –

Moving on, you can use a WP plugin to show an out of date warning text on your content. I think there are a lot, although I’ve not seen many when searching at the WordPress Plugins page. I’ve only used 2 so far. I could not find the original one I used way back. The one I’ve found so far is the DX Out of Date plugin.

Plugin to the rescue!

The DX Out of Date plugin is simple and serves its purpose. There are some customizations that comes out of the box with it. Not so much that you get configuration overload, and I think that’s fine. The one thing that it lacks though is the option on where the warning message is displayed – in a post or in a page.

It seems by default the DX Out of Date plugin will show the warning everywhere, whether it be in posts or pages, that meets the criteria of the content being old. This can be controlled to some degree. That is, the option to show the old content warning can be turned on or off at the posts level only. You go to that post, edit it, then on the right-hand side there is a checkbox there to toggle this functionality for that particular post. As I mentioned before, Posts only.

The image that follows is what it looks like on the side bar when editing a Post-type content.

Image 1.1 – Out Of Date Notification toggle at per content level

What about Pages?

Unfortunately, the toggle option for a Page is not present. Which is weird. This means that the warning message will show by default on all Pages depending on how each was configured (As in, there are no other plugins controlling/overridding that page, i.e. Nimble Page Builder plugin overrides most). There is no way to control this right now. I’ve found out that some pages show the warning while some do not for some vague reason. So sometimes you are left with an About Me page with the warning, another page doesn’t have it. Pretty inconsistent. Besides, Pages are supposed to be timeless content as opposed to Posts, WordPress skips showing a date-time in it even in the page’s URL, ergo showing a old content warning is ironic.

There appears to be a global toggle for that always show when outdated in the plugin’s admin settings panel, but I can’t remember if it’s checked after installation. So perhaps the work around is to turn it off, then manually enable it to each of the posts. This can become quite a task if there are dozens and dozens of posts.

Hacking the plugin…

To overcome this deficiency we can hack the plugin code directly. There are only 2 lines that needs changing located in 2 PHP functions in a single file to accomplish this goal. I may be missing out on other things. My tests so far were successful in the intended behavior after the modification without other unintended results.

Step 1

Go to the DX Out of Date plugin’s code, then find the file named – dx-ood-settings.php.

It doesn’t matter how or where this is done. WP has an in-built plugin editor where codes can be “tampered with” easily. Be warned that this is not the recommended way. The other approach is to find the plugin folder from the WP install location. Edit the aforementioned PHP file in that folder through a 3rd party editor. Before you do this remember to create a back-up copy of the file.

Step 2

Find this PHP function – custom_metabox_settings() – then start editing on line 318 as shown below.

313         public function custom_metabox_settings() {
314                 add_meta_box(
315                         'dx_ood_enable_noti',
316                         esc_html__( 'Out of Date Notification', 'Show Notify?' ),
317                         array( $this,'render_custom_metabox_option' ),
318                         'post',
319                         'side',
320                         'high'
321                 );
322         }

The original value on that line is just 'post', as the snippet above shows. Change it to look like so, array('page','post'),. It should now look like the image below.

Image 1.2 – Modify custom_metabox_settings() function

What happens here is that the metabox that shows the checkbox on the sidebar as shown in Image 1.1, only will appear if the content is a Post-type. Now we are adding the type Page to the arguments, as an array, so it will show when editing Pages as well.

Step 3

The 2nd function to modify is called – save_custom_metabox() – then start editing on line 344 as shown in the following code snippet.

338         public function save_custom_metabox( $post_ID = 0 )     {
339                 // dont run if in quick edit
340                 if ( !isset( $_POST[ 'ood_status_flag' ] ) ) {
341                         $post_ID = ( int ) $post_ID;
342                         $post_type = get_post_type( $post_ID );
343                         $post_status = get_post_status( $post_ID );
344                         if ( "post" == $post_type && "auto-draft" != $post_status ) {
345                                 update_post_meta( $post_ID, "dx_ood_enable_noti", $_POST[ "dx_ood_enable_noti" ] );
346                         }
348                         return $post_ID;
349                 }
350         }

Change that line to look like this, if ( ("page" == $post_type || "post" == $post_type) && "auto-draft" != $post_status ) {, as shown in the image below.

Image 1.3 – Modify save_custom_metabox() function

Without this change, the checkbox will appear in Page-types but won’t do anything. You can click on it and save the page, but nothing will happen. This addition to the code will change that to the desired effect.

Finally, don’t forget to save the PHP file.

Once you’ve completed all the modifications test it out. Go to any Page-type content and edit it. The metabox for the Out of Date Notification should now be visible. You can then turn it on and off from there. Have fun! 😉

Warning: Don’t do this if your version of the DX Out of Date plugin is 2.0. Looking at the description of that version, it looks like the author of said plugin has already fixed this issue.

Additional references from the ofificial WordPress documentation if you want to read more about it:




The DX out of Date WordPress plugin’s latest version 2.0 now comes with the “Added an option to choose which post types to display the notification for”. Which is similarly what I did here for an earlier version of this plugin that didn’t have that feature yet.

You can download that here:

Similar Posts:

What is this outdated notification? The quick answer is that it is a warning text shown somewhere on the web page that says the article was written on – insert old date here – and the information in the content may be out of date. This may be kind of redundant when your article has…