As far as I can tell, there’s no performance difference. And both styles are acceptable by WordPress Coding Standards as you can read in:
Braces should always be used, even when they are not required:
and
Note that requiring the use of braces just means that single-statement
inline control structures are prohibited. You are free to use the
alternative syntax for control structures (e.g. if/endif,
while/endwhile)—especially in your templates where PHP code is
embedded within HTML
I always use the brace styles beucause I think is more widely known by PHP programmers of different levels and makes the block “hierarchy” much clearer and easier to understand.
Bottom line: you should choose what is more convenient to you. And whichever you choose, be consistent and stick to it.
Related Posts:
- wp_enqueue_script adding conditional statement not working
- Check if first paragraph is an image, then show custom code right after it?
- If post author role is X
- Can a conditional statement apply to part of a slug?
- Add default content to posts in a specific category?
- is_front_page, is_page(‘slug’), is_page(id) not working
- Need help on creating If-statement for custom meta fields
- How to make gravatar.com avatars conditional?
- Loading Scripts on Specific Pages
- Condition function for is parent category?
- Conditional Statement – Best Way to Remove Nav on Contact Page
- Proper syntax for simple conditional bloginfo language
- wordpress is_page() problem
- Location-Based Content
- Personalized message for each unique password-protected page
- Conditional Shortcode image display
- Change Woocommerce order button page on particular page
- Change a url / link if a user is logged in?
- to create own conditional tags for business directory in wp
- How to use “Cases” instead of “IFs” for conditional logic
- Nested conditionals
- Is there a way to password-protect part of a post?
- if/Else have_posts Else fails to echo message to page
- Conditonal statement for iPad
- Return function only on certain pages
- How to write this conditional statement?
- Conditional for Custom Post Types
- Date-Based Conditional Tag
- Message box when accessed from iPad
- Show this code if user has previously left a comment
- Insert a conditional in the middle of a function to give it 2 different outcomes
- How can I use ‘edit_form_after_title’ conditionally?
- Force Log in to view a page
- Conditional loading of CSS for my plugin
- Looks like this if condition is not working [closed]
- Generating images from an array of categories
- WP conditional site logo and header block
- How to know if the most recent article
- Widget logic conditional widget
- How to display image on condition that a selection has been made
- How to Conditionally Not Display a Link Based on Current URL?
- Allow users to only CREATE one single (custom) post
- If statement to check for post_content
- why is my custom loop failing?
- Conditional sidebar menu
- What is the best way to disable my WP website if the user has adblocker on? [closed]
- Why isn’t is_page working when I put it in the functions.php file?
- Display navigation menu item conditionally based on user capabilities
- Show content after the first and second paragraph
- How to display the_post_thumbnail if a post has one or otherwise display the first image in a post?
- Display only certain posts based on visitor’s country?
- Exclude custom function content from certain pages
- How to tell if the user is an admin?
- Function like in_category for custom taxonomies
- Conditions for Users and Visitors
- Custom Menus, Widgets & Conditional Statements
- How to show my sidebar in specific page only?
- WordPress equivalent to Drupal Views? [closed]
- Conditionally load child themes
- Display Footer Shortcode Different for Logged In Users
- How to Arrange PHP Files to Allow for Multiple Types of Pages?
- Determine page content based on page parent
- Conditional Tags Based on Previously Viewed Posts
- Conditional based on number of specific custom taxonomy terms in archive.php
- How to conditionally hide author name on Single.php if category is “news”, otherwise if category is something else display author name?
- Dynamically output a class to an anchor tag depending on what tag is chosen
- Conditional: IF post creation date is in the first half OR last half of the year [closed]
- FacetWP – conditionally display facet labels
- Conditional does not work with add_filter
- Check if sidebar is rendered?
- Dynamic Sidebar Conditional [duplicate]
- Why might conditionals not work on a page?
- Add class to DIV depending on page loaded
- Using PHP Increment and Conditional Statement to Alternate Loop Background
- Conditional statement not working in function
- How to hide a menu from public, but share content with a private link [closed]
- Can I set up a hover animation in CSS depending on a PHP conditional?
- Multidimensional Array
- Conditional featured image with youtube thumbnail
- do_action in conditional
- How to get type of archive whether it is post or date or category archive?
- Parse a shortcode differently based on on what it’s nested in
- Help with this custom field conditional if no field is set display nothing
- exclude custom post type from running a function
- wp_enqueue_script JS code runs too late (after user begins interacting)
- Contact Form 7: conditional logic in e-mail
- How can i conditionally load taxonomy-{taxonomy}.php template php files through functions.php
- Conditional formatting on data fetched from MYSQL
- Find and print first entry from WordPress post in custom excerpt?
- Adding if statement
- How can I check the rewrite slug of current post type listing page
- Dynamic Content w/ geolocation in WP?
- Conditional redirect on login using referring URL
- Loading scripts only if a particular shortcode or widget is present
- How to display content If function exist/condition true?
- Conditional required fields for WordPress Contact Form 7
- Issue in If else condition [closed]
- Help with if else statement for separating content from image attachment
- Subpage Conditional
- Conditional display based on ACF checkbox