Title: Published Data and Modified Date
Last modified: November 19, 2020

---

# Published Data and Modified Date

 *  [bodabas](https://wordpress.org/support/users/bodabas/)
 * (@bodabas)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/published-data-and-modified-date/)
 * Hi, I hope someone can help me.
 * I wanted to display a modified date when there is a post revision. Otherwise,
   show only the published date if there is no modification. Playing with the code
   below shows the last modified data even though there is no post revisions.
 * How can I make it to show Published Date only when no revisions? The code doesn’t
   seem to work even using isset.
 *     ```
       /* Replaces same named function in /inc/blog/blog-config.php */
       function astra_post_date()
       {
        $format = apply_filters('astra_post_date_format', '');
        $published = esc_html(get_the_date($format));
        $modified = esc_html(get_the_modified_date($format));
   
       $output = '<p class="posted-on">';
       if (!empty($modified)) {
       $output .= 'Last Modified: <span class="updated" ';
       $output .= 'itemprop="dateModified">' . $modified . '</span>';
       } else {
       $output .= 'Published: <span class="published" ';
       $output .= 'itemprop="datePublished">' . $published;
       $output .= '</span>';
       }
       $output .= '</p>';
   
        return apply_filters('astra_post_date', $output);
       }
       ```
   
    -  This topic was modified 5 years, 6 months ago by [bodabas](https://wordpress.org/support/users/bodabas/).

Viewing 1 replies (of 1 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/published-data-and-modified-date/#post-13684746)
 * Check if $published and $modified are the same or not. All posts have a modified
   date, even if there are no revisions.

Viewing 1 replies (of 1 total)

The topic ‘Published Data and Modified Date’ is closed to new replies.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 1 reply
 * 2 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [5 years, 6 months ago](https://wordpress.org/support/topic/published-data-and-modified-date/#post-13684746)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
