Hi @shahekta43,
There are three ways to achieve this:
1. Using the admin dashboard: This approach does not require coding and is a hacky way to remove dates.
Go to the admin dashboard > Settings > General and on the date format section, select Custom and delete whatever is there and click on Save Changes.
The drawback is, this will affect all the places that displays the date.
2. Using Custom CSS – For this, you need to know the class name of the element that is displaying the date. Like @corrinarusso mentioned, we would require the site URL to figure out the class. Once we have the class, we can go to admin dashboard > Appearance > Customize > Additional CSS and set the class’s display property to ‘none’.
3. This approach requires coding and is the most reliable out of the three. If you are comfortable with coding, you can add the below code in the functions.php file of your child theme.
function remove_date_from_post( $the_date, $format, $post ) {
if ( is_admin() ) {
return $the_date;
}
if ( 'post' !== $post->post_type ) {
return $the_date;
}
return '';
}
function remove_time_from_post( $the_time, $format, $post ) {
if ( is_admin() ) {
return $the_time;
}
if ( 'post' !== $post->post_type ) {
return $the_time;
}
return '';
}
add_filter( 'get_the_date', 'remove_date_from_post', 10, 3 );
add_filter( 'get_the_time', 'remove_time_from_post', 10, 3 );
This will only remove the date from the post post type.