You are using the ternary operator incorrectly to simplify your code – it doesn’t use/need the if()
, use it as follows:
echo (strlen($current_user->user_firstname) == 0) ? $current_user->display_name : $current_user->user_firstname;
Related Posts:
- Activate a plugin through PHPMyAdmin or FTP?
- WordPress plugin installation error
- WordPress error – PHP Fatal error: Uncaught Error: Call to undefined function register_block_type_from_metadata()
- Can’t access my WP dashboard: fatal error? [closed]
- Using plugin functionality in external php script not working
- Multiple files in a plugin
- Can I delete plugin files using FTP?
- Elementor\Scheme_Typography’ not found [closed]
- WordPress Blank Screen Issue [closed]
- Fatal error: Call to undefined function cmsms_theme_page_layout_scheme()
- Why “Call to a member function on a non-object” in plugin only?
- Fatal error can’t activate a plugin [closed]
- Cannot access my wp-admin after installing Gzip compression [closed]
- Invalid plugin installation directory, Google Analytics [closed]
- How to prevent PHP fatal error if plugin hasn’t been enabled and a method is called in theme file?
- Fatal error on some pages after cancelling WPSTAGING cloning process
- There has been a critical error on your website – won’t fix no matter what
- 5 PHP Fatal error: Uncaught ArgumentCountError (Cannot Find)
- Error with get_price (and others) in self-written plugin to show price
- After a manual update, themes and plugins that were installed (and still in the directory) are not being seen
- Manualy Updated WordPress Error
- Replace old theme that understand old css (vcex_icon_box css_animation)
- Fatal error “Call to undefined function is_plugin_active” each time the plugin is activated
- Fatal error: Class ‘RDTheme’ not found
- Making a Custom Post Type Plugin – keep getting the white screen of death
- Call to a member function get_error_messages() on null [closed]
- Fatal error when accessing Pages in WP admin (and problems editing any pages)
- Plugin Breaking WordPress Login
- Fatal error with jigoshop and woocommerce
- Plugin won’t activate, fatal error (widget class not found)
- How to fix ‘Call to undefined function do_settings()’ error?
- is_plugin_active() not defined on active plugin, in the thumbnails.php file
- White Screen When Includding A Folder With PHP Files
- FATAL ERROR: WP complains about redeclaration [closed]
- Unable to access WPadmin, website down
- WP Elementor Pro causing crtical failure on website
- How to fix Fatal error: Cannot redeclare get_cli_args() in class-wp-importer.php
- When does WordPress.org notify sites of new version?
- Get a button for in the Editor
- How to create gutenberg block using REST API independently or as headless way?
- How can i force Display names to be the same as Usernames?
- Set active theme via URL
- How to automatically add and show(open) all the product attributes?
- Plugin Not Working, But Only On GoDaddy Hosted site
- Long running action from plugin
- Custom field in TWIG template – Advanced custom fields plugin
- How to get all events from ‘All in one Events calender’ plugin in JSON format?
- Bulk Image Uploader to create new post from each image [closed]
- How can I implement a notification system in wordpress?
- Internationalization: Not loading plugin translated text
- Gravatar images are not fetched in Ultimate Member plugin
- Building an email signup form. Where should the information be saved in the DB?
- Plugin Code ONLY on Post Edit Page
- qTranslate conflicts with SEO-plugins [closed]
- Multi language site [closed]
- Ajax fail and get 504 error
- Want to Show Sub categories under Categories section using Woo Commerce [closed]
- How to customize the grid layout in reactive pro wordpress plugin [closed]
- Subdomains with almost the same content
- WordPress page and plugin list using sql query
- Xili language plugin not showing language flag [closed]
- Custom Post Type – custom form in dashboard
- Getting 400 Error: redirect_uri_mismatch when trying to grant permission to Gmail SMTP plugin
- How to transfer data from an additional field in the tags?
- How can I apply no-disposable when programmatically adding a user with wp_insert_user()?
- Translation to ACF relationship field
- Expected ‘add_filter’ (T_STRING)
- Theme Functions run a function upon activation or preview
- Custom Module, Extending WP with a Plugin?
- Warning! PHP safe mode enabled!
- Dictionary-style definition list plugin
- Error Metabox Warning: call_user_func() expects parameter 1 to be a valid callback
- I created a plugin with ‘view page’ that uses MYSQL + PHP. When I use wp_insert_post(), it turns everything to HTML
- WP Posts-pages text hiding does not work
- Update content without the user having to refresh their page
- How to override the plugin in woocommerce
- ajax voting for custom post type
- How to see in Edit Comments if comment is from User and her Roles
- Delete postmeta when uninstall/delete plugin
- How to remove a css class for any wordpress page
- Should I paste CDN links in a JS file or use a Bootstrap CDN plugin?
- How to Order Sticky Posts? [duplicate]
- export high ress images to pdf
- Embedding code snippets in posts with indentation
- SWF in wordpress post
- Fake Single WordPress Post (Page) Loop
- woocommerce download post-types\writepanels limits?
- WordPress get id from json data with json_decode()
- Extend my plugin settings with hooks
- Make a plugin work on specified domain only
- how to change location of the plugins & wordpress themes folder
- how woocommerce swatch color name when hovered or selected
- Undefined constant error in pluggable.php
- WooCommerce plugins permalinks?
- Loading Canvas & WooCommerce translation file in child theme
- How to Move a production WordPress site to local environment [closed]
- Can’t activate plugin [closed]
- Meta box not displaying on the plugin page
- Warning: Undefined variable $admin
- plugin translation *.mo file not getting loaded for custom post