You can get custom fields randomly using the below code that you can combine with your existing code to get desired output.
function wpll_get_popular_nodes() {
global $wpdb;
$custom_fields = $wpdb->get_results( "select DISTINCT meta_value from $wpdb->postmeta pt LEFT JOIN $wpdb->posts p ON (pt.post_id = p.ID) where meta_key LIKE 'tax_image_url_universal' ORDER BY RAND()" );
if ( is_array( $custom_fields ) && ! empty( $custom_fields ) ) {
$count=0;
foreach ( $custom_fields as $field ) {
if ( isset( $field->meta_value ) ) {
$count++;
echo $field->meta_value;
}
if( $count >4 ) break;
}
}
}
Related Posts:
- Is There a Difference Between Taxonomies and Categories?
- What is ‘term_group’ for ‘order_by’ in get_terms()?
- Order get_terms by term meta
- Display all the subcategories from a specific category?
- Get parent id by term id
- How to get_term_children output in alphabetical order?
- When to / not to use wp_get_post_terms vs get_the_terms?
- Control term order on a per-post basis
- Why does WordPress combine a term with the same name in the wp_terms table?
- What is the difference between terms and tags?
- Correct use of get_the_terms()
- Get multiple term IDs by slug, and then exclude them in get_terms
- wp_list_categories: order by term order?
- Child terms from multiple parents?
- I have a term_taxonomy_id — is there an API call to get the taxonomy?
- show tags of custom post type ONLY
- Exclude Child Terms From Parent Posts
- same taxonomy for several post types: how to hide empty in a specific post type?
- How to sort terms with diacritical signs?
- wp_set_object_terms creates relationship to REVISION?
- get_terms(); show private posts when logged in
- Get category ID after wp_insert_term
- How do I access a single term from a post?
- Prevent Selected Terms Rising to the Top
- How to order get_term_children output by alphabetic order
- Are Categories, Tags and Custom Taxonomies any different in regards to SEO?
- Non-hierarchical custom taxonomy using checkboxes on edit-screen -> saving issue
- How to update incorrect post count in taxonomy?
- Term begins with a letter
- Display tags belonging to a specific post type only
- get_post_terms not working as expected
- wp_update_term not creating new unique slug
- has_term() does not return when term is assigned post?
- WP Query for Posts (Products) in Specific Category that has 2 Specific Tags (*AND* both tags not *OR*)
- get_terms() but with additional dimensions?
- Wp set post terms not work
- how is it possible that using wp_insert_category throw a fatal error?
- How to Get All Taxonomies AND All Terms For Each Taxonomy With Post Count Zero
- How to add class on term link?
- get_terms only show term if there is a post using it
- Get post terms for multiple posts at once?
- get_terms with more than x post count
- wp_update_term: How could i update the “name”?
- Get the Term List – Ordering
- Strict tag list – user should choose only existing tags for posts
- How to remove/hide the predictive autocomplete popup when I type in the tag/term metabox
- Reduce / optimize calling of wp_get_object_terms() when generating permalinks
- Check if an array of posts has posts from a specific category
- Limit tag cloud terms by date
- Allow only 1 instance of each term in each custom taxonomy
- Get only one product category woocommerce
- Display custom list of tags in post/page editor with hooks
- How to trace/fix false $term->count, rogue term relationships?
- How to order and count get_terms by specific post type?
- Get those terms with a specific meta key value
- get_terms() order by term_meta
- How do I get the current tag out of a taxonomy?
- Difference between get_category, get_term_by and get_categories
- get_terms() for custom taxonomy related to another taxonomy
- get_terms from registered taxonomies not working
- What is the term shortlink structure?
- how to filter each tag item?
- get_term_by “name” not working with & in name
- I want to loop through Woocommerce Product Catogories and show them in dropdown
- Invalid argument supplied for foreach() in search.php
- setting taxonomy term to bulk posts using ids
- Display assigned terms with link
- Do I have to set parent when set post term?
- How do I determine if a certain term is in an array?
- WordPress Related Post by tags in Single.php
- Modify automatically generation of slug when term is created
- Display custom taxonomy on single post
- get_terms ‘number’ parameter does not appear to work
- get_tags() return an empty array after added tags with wp_insert_term()
- Does get_terms() use any sort of caching on its query?
- Question with get_the_term_list
- Group child category IDs based on their parent category
- 404 on term taxonomy archive pagination only with some terms
- Get posts inside Get terms problem
- Set attachment tags from attachment’s custom field data
- Clone Terms of one taxonomy to another
- Custom Template for one Taxonomy Term
- Unset actions for terms parent only
- Get random out from get_terms()
- Create / Close Div in Array [closed]
- Conditional based on number of specific custom taxonomy terms in archive.php
- Categories order with get_terms_args not working in 4.7
- Getting all categories even with no products under it?
- Sticky posts per category
- Faceted search with WP-API data
- Is There a Difference Between Taxonomies and Categories?
- Generate list of tags from search results
- Show List of Terms (not posts) that have been Recently Updated?
- import_id parameter for wp_insert_term to create custom ID for category
- Programmatically add posts add and assign postmeta and assign terms
- How to sync to custom taxonomies (tag structure)
- When using the get_terms and trying to order the terms using the ‘order’ and/or ‘orderby’ does not work
- get_terms – name__like a number
- Query to get term id using post id?
- Why does wp_get_object_terms add a period after terms are output?