Fastest way would be something like this:
$fruit_id = get_user_meta($user_id, 'fruit', true); //returns 1
$display_fruit = some_fruits($fruit_id); //will return 'Apple'
Related Posts:
- Calling a method from functions.php on a click of a button
- How do I display a user’s previous orders as a select box option on a product?
- How to check if a meta value has already been assigned to any user?
- function to assign user role based on a field from usermeta
- How to abort saving data in save_extra_profile_fields function WordPress?
- Update user profile information from functions.php
- Countdown to date function?
- If Array Values Match Another Array’s Values, Then
- Shortcode for Listing Users from Meta Value?
- Uses for function: wp_update_user
- How to add and subtract user meta values after post meta update
- Include User ID in iFrame URL
- WP custom posts: filter results to custom taxonomy tag that corresponds to user meta field
- Display current user metadata on WordPress page
- How Can I Display the Last Modified Date for User Profiles on WordPress?
- Get user by meta data key and velue
- Where do I implement this display of User Meta Data, and how to put it in a table?
- Add another role to a user when they click a button?
- Store custom field’s multiple values in one user meta key
- Get field in readable word
- Private messaging – Getting and displaying the avatar/url of a message recipient
- Get author meta of all writers
- A better way to write this php function
- WordPress Infinite Scroll without using any plugin
- How to remove a metabox from menu editor page?
- How to overwrite youtube embed?
- How to add active class to custom menu using while loop and wp_list_pages
- New Plugin Review
- Problems with function on function.php
- How to add SVG icon above product tab title
- Generating add_settings_section() calls dynamically
- Remove query string specific key value
- is_page “range” for if statement?
- WordPress child theme fails to override parent navigation menu in /inc/structure/header.php
- jQuery not defined
- Converting HTML Template to WordPress Theme
- WordPress add post format support not working
- Error when adding excerpt to the content through functions.php
- Add data attribute to each li in menu
- Prev/Next child navigation for current page modifications?
- Adding rel tag to all external links
- How can I apply_filters from inside a function?
- Pass Category Name, Description and Photo into variables to pass to jQuery
- Populate editor with some content of a page with a page template
- I want to load in a new class but only if the current page is single-movies.php
- Skt full width basic slideshow problem
- php syntax : [ && ] between commands [closed]
- Which PHP page is the Default Posts Page
- Need to put a script above tag in header.php – WP 5.7.1
- Pagination broken on is_front_page()
- Content filter won’t work
- Why does the post_type_link hook everything twice?
- Warning: in_array() null given in PHP function
- use loop to return blog details
- Fetching Initials of the Commentator in the WordPress Website
- Adding function to child theme’s function.php
- Missing a text-domain esc_attr_e
- Extract and display user infromation on an automatically created page
- Is it legal to redefine wp_password_change_notification in a mu plugin?
- How can I assign separate stylesheets to different pages?
- Programmatically revert to backup .htaccess a possibility?
- Execute PHP code only with specific user role
- WP Container Displaying Only on First Page of Archive
- WordPress User Meta value variable into Google Gauge Chart
- PHP function for horizontal Woocommerce thumbnails and badges
- Embed video from streamtape using direct link
- Is there a PHP function that will return the block ID generated by WordPress?
- Creating a Function and Call It
- WooCommerce display price before add to cart [closed]
- Show sidebar only to author of post
- How to move a post from one category to another
- how to add custom select field to wordpress edit page
- How to override theme’s public static function inside of a trait?
- how to use 2 index.php file One for mobile and one for desktop
- not able to access $_POST on backend profile update
- Theme editing “post thumbnail” help
- How can I export data without using any import/export plugin
- Restrict File Type Uploads by User on Wordress via functions.php
- How to Request a User to Register on Landing at a Site, Then Automatically Delete the Users Password on Logout?
- Matching multi user
- Add disclaimer before certain posts and pages
- AJAX Returning Way Too Many Posts
- Where can I find the declaration of `$_wp_theme_features`?
- redirect 301 with special character like WIX site “#!”
- auto metakey value on post tile
- How do I routinely extract the thumbnail of the most recent post?
- wordpress ajax return 0
- How I can add div to menu?
- Modify category archive page loop on functions.php
- How to print redirected query string variables to the page?
- Admin-area broken through weird issues
- Check if values exists DB
- Search box background on a different page template
- WP Ecommerce: Display the “Order Notes” as column in the Sales Log [closed]
- How to modify this function to exclude also the post belonging to a specific category?
- A next page function with shortcode?
- What is the wrong with this function to enqueue the scripts and styles to the theme? [closed]
- Need help with conditional logic for menus
- Custom Admin Menu Report for Specific User ID
- how to create twitter card without plugin in wordpress website?