<?php
if ( is_user_logged_in() ) {
$current_user = wp_get_current_user();
echo '<a class="btn" href="https://wordpress.stackexchange.com/author/" .
$current_user->display_name .
'">Channel</a>';
} else {
echo 'Welcome, visitor!';
}
?>
Note that get_currentuserinfo()
is deprecated in favour of wp_get_current_user()
.
Related Posts:
- Should all plugins be encapsulated in a Class?
- Preserve custom URL parameter on more pages
- PHP code on Visual Composer Plugin
- if plugin is active? check if plugin is enabled or not?
- Making plugin unique to not conflict with plugins with the same name
- How to find out if option exists but is empty?
- How to store ACF custom fields data in a custom table
- Trying to disable plugins doens’t work
- Thumb rating for wordpress – top user
- Errors while using ajax from external wordpress page
- Have Plugin Handle Specific URLs
- Setting up widgets in wordpress with a unique ID for the after_title argument
- post expire after x days
- allow arabic letters when register new account
- How to get all events from ‘All in one Events calender’ plugin in JSON format?
- cURL error 60: SSL certificate problem: unable to get local issuer certificate
- How do you remove plugin edit option?
- Make specific products accessible only to a user role in WooCommerce
- Where should I save an API key of my user when installing my plugin?
- Accessing post’s meta data based on user’s click of a post
- Custom form action to handle data inside a plugin
- WP Post Template – Templates in own folder
- How to add equivalent of php include to one page (as plugin?)
- Override Plugin Script Fucnction in WordPress
- Image upload and download from front-end
- Shrink down register_settings on Settings API
- Parse error: syntax error, unexpected ‘new’ (T_NEW) in /misc/41/000/204/381/9/user/web/ragami.net/wp-settings.php on line 219
- How to call WordPress function other files
- Removing an action from wp_footer called in a class that’s inside a bigger class
- Ajax call returning 0
- Some code in shortcode function being ignored
- Subdomains with almost the same content
- Using window.onload with Ubermenu
- What is @Action in WordPress?
- How to include this jQuery File in wordpress?
- PHP Error When a plugin is active
- Inserting custom PHP script on homepage
- Add bcc to contact from on wordpress
- Getting taxonomy images to display on single-post with their terms
- Custom shortcode for displaying user based on a role parameter
- wp_enqueue_scripts
- WordPress Console Application (ability to excecute a custom function via crontab only)
- Get all the URLs of the pages that uses a specific shortcode
- Wp Debug Enabled True Notices and Warning
- Pagination shows Same posts
- Theme Functions run a function upon activation or preview
- Is this plugin safe to run?
- WP Subtitle Plugin Problem
- Custom Plugin scripts from admin working in frontend
- WooComerce Deposit: set specific shipping method and quantity based deposit amount
- Unexpected add action function in WP plugin
- How to get brand children with woocommerce brands
- Prevent WordPress from sending set-cookie http header
- Is there any way to sync Facebook Comments and with comments on WordPress website?
- How to add a prefix to a WordPress post preview url?
- i can not access the post in custom template of my wordpress plugin
- How to get a specific string from a url
- location lock wordpress website
- Use AJAX to fetch Current Post Thumbnail for WordPress when Uploaded throughMedia Uploader Frontend
- Easiest way to load/fire a handful of functions, IF checkbox is checked?
- How to avoid the 403 Forbidden error in a WP Plugin with Ajax and PHP
- How much PHP and MySQL or MariaDB knowledge should I know to start writing WordPress themes and plug-ins and whatever else a beginner can edit?
- post id or permalink auto-incrementing number and reset everyday
- How To Use htaccess to Rewrite Link Structure for a Page that is Generated Programatcially
- WordPress logout appends cache/all/index.php to the site_url()
- Reverse count page view and show on other page
- Change (replace) word in metabox
- Caching of combined CSS and JS fails because of losing MIME types through combining by PHP
- Change pricing in Woocommerce based on Category and Product [closed]
- Register setting on plugin activation
- WordPress environment not loading properly
- How to remove a css class for any wordpress page
- Add class as plugin for other plugins
- Social sharing plugin directing to blank page after post sharing
- Displaying friend’s posts only
- using href when creating wordpress plugin calls empty page instead of php file
- Media Playlist Plugin
- Saving custom form fields
- How to add php stylesheet to admin section instead of admin_head hook
- Template from scratch: Sidebars not showing widget
- Contact Form 7: custom validation [closed]
- Enforce conditions only for draft posts using WyPiekacz, ignore pending and published posts
- Replace Dash (-) and Underscore ( _ ) with Space
- How to add homepage Widget?
- What can I do to customize a widget provided with this plugin? from where have I to start?
- WordPress create permalink structure for custom post type with userid
- Shortcode inside a redirect [closed]
- Attachement title in wpallimport
- Block registration with viewScript
- Function not being called on form submit, only blank admin-post.php page
- cURL External API request displays content above other content on page
- How can I save the selected page in the dropdown after anyone clicks on Save Changes?
- Posts in Admin only display 1 Post instead of all Post in admin area
- How can I save the selected page in the dropdown after anyone clicks on Save Changes?
- WordPress Convert queries to slashes using function.php
- Creating a Table Row by Row
- Getting 504 Gateway Timeout Error on AWS Server! [closed]
- WordPress issue – data is not showing in wp-admin, but when searching through database, all the data is there
- WordPress Throwing Deprecated Errors on its own Files
- plugin doesn’t retrieve data from database