instead of $currentdate = current_time('Ymd');
you can use $currentdate = new DateTime();
so the Final Solution should be as like given below
<?php
$currentdate = new DateTime();
$date = get_field('course_start_date', false, false);
$date = new DateTime($date);
if ($currentdate > $date) {
echo ' - Started.';
} else {
echo ' - Not started.';
}
?>
Related Posts:
- Show content if parent page has children
- Current post’s author name in the author meta tag
- Conditional statement for parent, child and grandchild pages
- Trying to use Ternary operators with WP Conditionals
- get_transient(), PHP switch(), and comparison operators
- When is is_admin() available?
- Check if current page is wp-admin
- Second Navigation inside header
- Using is_page() in functions.php not working at all
- Output 2 items within the Loop
- conditional statement for custom taxonomy
- How to enqueue CSS and JS only on specific template?
- how could I load a different template part by page
- Is there a WordPress version that is incompatible with PHP 5.3?
- WordPress, AJAX and pre_get_posts using conditional tags
- If tag equals then show else show
- How can I display a div ONLY if it is not a certain term page
- Don’t show certain div on front page?
- If ‘editor’ is empty, then
- Add class to DIV depending on page loaded
- How to: Conditionally Enqueue JS and Stylesheets, for Custom Post Type (Single and Archive Templates)
- Undefined index for default custom theme option
- Remove conditional tag from header
- Display an image based on field value
- Multidimensional Array
- Conditional string comparison failing for basename/slug
- “if parent category is” conditional?
- Conditional for Post Format
- conditional: if is page, and all subpages
- Woocommerce getting top level category parent and make all sub categories have the same template and menu
- page 1 is not paged
- How to add Text before my Custom Term and hide it when empty
- How can i create a function tag in my plugin
- Add code to the header of posts by particular author
- Display specific page if user signed in
- How to get Post sidebar & footer including html like get_the_content() which only gets content section?
- Widget Logic – display on page and all child
- Need to adjust condition to say if I’m pulling categories from a post, to pull only the first one
- if user is admin display admin link and logout link else display logout only
- Add code only for blog posts
- How to define Og Meta Tags in header using conditions [duplicate]
- If Month=Particular month display content [closed]
- How to echo a different field if another field is empty?
- Adding else if conditional statement to purchased theme
- Conditional in foreach loop is outputting content twice
- Advanced custom fields Repeater conditional statement not working [closed]
- Load slideshow.css file only if Slideshow is checked / on
- Issues trying to add a href statment with PHP into a PHP Echo Statement [closed]
- if is specific custom post in cpt
- advanced custom fields: repeater field within conditional statement [closed]
- WordPress Block Editor Gutenberg running code inside ! is_admin()
- ACF number less than comparison not working
- How to make my scroll bar show under condition
- Side bar only if it’s not a single post or a specific page
- WooCommerce: Custom dropdown for variation selection
- Upload non-featured image to image field
- Usage of call back function of add_meta_box()
- Building a REST API for your web app exposes primary keys of DB records?
- WordPress get_media_embedded
- Change product_base programmatically
- wp_delete_comment takes two tries to delete – then deletes all comments
- php redirect with custom user roles set and working but redirect not working for when users are logged in
- how to get serialized post meta
- Hide Heading if ACF Field is empty
- Scheduling an event inside plugin class is not working
- How to remove the message ‘We could not find any results for your search’ without changing template files and without adding posts/pages?
- How to set a template with wp_insert_post
- WordPress Custom SQL Table with UserID Filter for results
- Automatically add images to a menu
- Display Yoast meta-description `wpseo_desc` within loop of categories and fail silently if no data is set [closed]
- Get access to variable from previous pageview, excluding ajax-calls
- Why is a wp function used in current PHP namespace’s callback not resolved to global scope?
- Permission callback to check if user has application password
- Load Posts on Click via Ajax into a DIV
- How to catch wordpress post ID when it’s published
- calling a custom field value inside functions.php
- What is the best way to define constant options for a theme?
- WordPress redirect redirecting too many times or not at all
- Can’t retrieve element with WordPress default @fetch_rss();
- set post limit at load more ajax wordpress
- I have a snippet to redirect all users to a maintenance page. How do I exclude users with admin role?
- php esc_html_e with an html link inside not working
- How to filter custom taxonomy term name, slug, and description?
- An audio player that showcase a random song from playlist every 24h [closed]
- how to prevent wordpress admin from logging in via woocommerce my-account page
- get_the_ID() in the footer returns wrong value
- Rewrite with pagination /foo/page/2/ to posts of a given category, page 2
- Trouble inputting variable into WP query
- How to get the last category name of a child category?
- Add html link in functions.php files of the theme
- How can I add a UTM tag with PHP code to pick up the post slug dynamically in the UTM?
- How do I include SVG file used as featured image?
- Use value from Ajax call in PHP function
- require_once() if a product in woocommerce contains a tag [closed]
- the_posts_pagination() not working in wpquery
- Automatic excerpt is not shown with the_excerpt() command
- Using ob_start and ob_get_clean with wordpress shortcode
- Change “No Comments” link to “My String” on Blog Post (Find Snippet in Code or use CSS, PHP Solution) [closed]
- Return product description
- How to add the sidebar to all the pages except the home page? [closed]