It’s probably getting the date as you expect, but the >
is essentially a mathematical operator and you’re trying to use it to compare two strings.
You can use strtotime()
to convert the dates to integers (# of seconds elapsed since 1970-01-01
), and compare those.
// Hide By-Line
add_action('wp_head','my_head_css');
function my_head_css(){
$excludeDate = date("2021-06-02");
$postDate = get_the_date('Y-m-d');
if( strtotime( $postDate ) > strtotime( $excludeDate ) ){
echo "<style> .entry-author {display:none !important;} </style>";
}
}
Related Posts:
- Why use if function_exists?
- get php variable from functions php and echo it in theme template files [closed]
- Use AJAX in shortcode
- Include files in child theme functions file
- WordPress Theme Update Action?
- How to get woocommerce inventory status [closed]
- Auto close (hide) custom metabox / set default state
- Does WordPress Development Mode Exist (with not minified JS)?
- WP_Query in functions.php
- Implementing DNS Prefetching with WordPress
- wp_delete_user with username
- what is the meaning of settings_fields()
- Organize functions.php
- Why do I get Fatal error: Call to undefined function get_most_recent_post_of_user()?
- Change labels on ‘Nickname’ and ‘Biographical Info’ in user-edit.php
- Edit the_content function
- write in functions.php
- How to set child post categories to parent post categories when updating parent post?
- get excerpt without images
- display 100 products per page on product category page [closed]
- Help to resolve Syntax error, unexpected ‘endwhile’ (T_ENDWHILE) [closed]
- Checked() showing up twice in custom fields
- Removing the first image in content
- Gravity Forms field entries into wp_query loop [closed]
- Global functions on WPMU
- Remove the deleted users avatar from list
- Update Content based on expiration time or queued processing
- is_account_page() change to page slug
- Adding to fontawesome-webfont.woff2 to boost website speed
- How to enable template page only for a post id page
- Help with WP gallery function, wrap gallery in div
- set_post_thumbnail when user is not logged in
- Force to use STRONG users password and implement rule to prevent REUSE [closed]
- Remove after images
- Get First Child Page ID or Permalink in WordPress Admin
- Footer disappears when using the_content ( )
- Get page id or status by private pages?
- Passing User_Fields to Contact form 7 [duplicate]
- How can this crude function be improved?
- How to override woocommerce.css?
- Connecting to a 2nd DB gives me no results when querying
- Including php files within template
- Author Date Function not working as expected [duplicate]
- Add_filter when value is no variable?
- The Loop not looping?
- wp_star_rating() – Adding a 5 star rating system to theme
- How to hide image-url if no attachment?
- New custom menu created. how to apply it?
- problem loading stylesheets to wp_head dynamically
- Use Composer Package inside class – Namespacing error
- How to properly refresh page after form action?
- Default Nav Highlight
- Update to functions.php not showing in dashboard
- Unable to point the child theme directory even using get_stylesheet_directory()
- Change WooCommerce add_to_cart Button Text?
- WordPress Website with Login system
- Return link pages instead of displaying them
- Adding Read More to Custom excerpts
- wp_get_attachment_image_src returns image on main domain, false on subdomain
- Get the alphabetical sorted data with wpdb
- WordPress Check User Role Function (multiple roles)?
- Add a custom function to widget code
- Add custom taxonomy using JS in post editor
- WordPress: Highlight search result exact matches
- remove edit link only for published post and pending post
- When are the user meta fields created in the database? Admin vs Woo API REST
- is_product_category(‘Services’) not working
- How to automatically add counted number to navigation menu items?
- Replace theme function
- How to access custom class methods from any include without using global
- Insert Modal on user first login
- Trying to load JavaScript only on pages within a PODS category/ custom post type
- More than one search results page template for two searches on site
- How do i create a search option for pdf’s only
- What is best practices to move the following code into a function?
- Correct way of Enqueue self hosted fonts in sass project
- function syntax is off,
- Return ACF Field value function
- Best way to add image to recent posts widget?
- Change category checkbox into radio button [duplicate]
- wp_enqueue_script only works outside of action
- How can I include user meta information in the resulting array of a WP_User_Query?
- How to add next height number in Order Attributes inside the Add new page. [duplicate]
- Show the online status of the current post’s author
- Functions.php in child theme that loads CSS file breaks website
- Get Value of Custom Field
- How does child theme functions.php work with parent theme functions.php? Is it like CSS? [duplicate]
- restrict access to specific urls on a specific period of time
- Change conditional tag in wordpress without editing the core files
- Undefined offset: 2
- Need a functions that adds (adm)/(mod) if current user is admin/moderator right after their username
- Add title & subtitle to shortcodes
- How to Delete Posts by title?
- clickable title of 2 post on mainpage USING functions.php
- Display function from functions.php in tag.php
- AJAX values converted to PHP Variables?
- Custom Post Type Search
- function to show youtube videos within excerpt – if condition and apply_filters
- How to automatically load Google Fonts on pages only as they’re used?
- sort by date in users