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:
- Control term order on a per-post basis
- Why does WordPress combine a term with the same name in the wp_terms table?
- Correct use of get_the_terms()
- wp_list_categories: order by term order?
- I have a term_taxonomy_id — is there an API call to get the taxonomy?
- 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?
- get_terms(); show private posts when logged in
- Get category ID after wp_insert_term
- How to order get_term_children output by alphabetic order
- Are Categories, Tags and Custom Taxonomies any different in regards to SEO?
- 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
- Wp set post terms not work
- Get post terms for multiple posts at once?
- 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
- Get only one product category woocommerce
- Display custom list of tags in post/page editor with hooks
- How to order and count get_terms by specific post type?
- Get those terms with a specific meta key value
- get_term_by “name” not working with & in name
- I want to loop through Woocommerce Product Catogories and show them in dropdown
- setting taxonomy term to bulk posts using ids
- Modify automatically generation of slug when term is created
- Does get_terms() use any sort of caching on its query?
- 404 on term taxonomy archive pagination only with some terms
- Get posts inside Get terms problem
- Clone Terms of one taxonomy to another
- Get random out from get_terms()
- Categories order with get_terms_args not working in 4.7
- Is There a Difference Between Taxonomies and Categories?
- Generate list of tags from search results
- import_id parameter for wp_insert_term to create custom ID for category
- How to sync to custom taxonomies (tag structure)
- How to get a post’s associated taxonomies and terms in wp api v2
- 100+ terms in any taxonomy slows down post updates?
- get_the_terms() not returning expected result
- Get all terms linked to a post and include those who not connected from get_terms and sort
- Get the ID of category page with or without any posts
- single_term_title() running before get_the_title() [closed]
- Get terms within a custom taxonomy
- WordPress Term for Custom List
- How do I print a term list but alter the link text?
- For each loop on every word in post
- How to get the $meta_type given the $object_id
- The Difference Between Categories and Tags and Taxonomies and Terms
- $args for get_terms() to return ORDER BY FIELDS
- How to create a array that contains all of the children slugs of a specific parent category
- Temporarily un-associate term for an amount of time
- How to extract one field from wp_get_post_terms objects?
- Default post_tag for custom post type
- Custom term templates
- INSERTING Data into table with placeholders
- Get Custom Post Child Term
- Add post tag without post id
- Show all videos by tag name
- Get fuzzy matches from get_term_by
- Taxonomy Drop Down with hierarchical view using $terms
- How to check if a term is parent to another?
- Create Terms on taxonomy by text field
- Customizing the wordpress tag-cloud output
- How to show posts from category A on category B page?
- How to use category slug to echo a page’s content with the same slug
- Can we apply hide empty to get_the_terms?
- wp_set_object_terms doesn’t work
- Why does term get inserted twice when using dynamic slug?
- How to use get_terms() returning only the terms that have posts with a certain custom field value
- how to show all categories by get_terms
- wp_set_object_terms() to update a post taxonomy value
- How to display taxonomy order child, parent
- Update term_id to new value wherever it exists, to combine the two.
- wp_get_post_terms – Do Not list Duplicates
- get_terms for all custom taxonomies shows invalid taxonomy error
- wp_set_post_terms struggle :(
- How to show only tagged CPT categories / taxonomies for a custom post type?
- Categories and Tags Conflict after Woocommerce Installation
- Is there any WordPress way to get all categories for some selected posts?
- Order terms by creation date
- Unable to retrieve any child terms using get_terms
- Get terms parent ID for conditional IF statement
- Get count for all terms inside a parent term
- add links to list of post terms
- list of tags overlay
- When I Use function wp_insert_term() function it gives me Invalid taxonomy object
- Get only last child category link of products
- Get Parent Custom Taxonomy Term and Color Div background
- Attempting to filter posts using get_terms
- How we retrieve the ‘tags’ and ‘attachment’ of the custom post which is created by wp_insert_post();
- Relate term to term?
- How can I filter get_terms with post meta
- Unable to import term_meta in wordpress using wp_cron
- How can I replace the values in WP_Term?