Search fails when using the radio buttons
Search fails when using the radio buttons
Search fails when using the radio buttons
This worked for me: In the template file (used with that existing form), before the get_header(); call/line, add this code: global $my_dates_MB; // If you changed the meta box ID (i.e. mydates), change it also below. add_filter( ‘rwmb_show_mydates’, ‘__return_false’ ); $meta_boxes = get_dates( [] ); $my_dates_MB = rwmb_get_meta_box( $meta_boxes[0] ); if ( isset( $_POST[‘my_dates_post_ID’] ) … Read more
To get the username of a user you can use the get_userdata() function. Pass it the users ID $user = get_userdata($user_id); Then the have access to the username or user_login as its called echo $user->user_login; You can read more about this function here: https://codex.wordpress.org/Function_Reference/get_userdata Or if you need to get the user by other information, … Read more
How to prepend text to custom field value A, but only if custom field value B matches a certain string?
this should work but you overwrite the values for existing objects. to add default values only for new objects try that : $postType = “tender”; add_action( ‘save_post_’ . $postType, function ($post_ID, \WP_Post $tender, $update) { if (!$update) { // default value for new object // Add the meta data you want the custom post type … Read more
If you are new and confused then please follow these link https://stackoverflow.com/questions/11068795/wordpress-get-post-based-on-meta-field-content And https://rudrastyh.com/wordpress/meta_query.html May be These may help You.
Okay. I solved it by myself. i dunno what’s wrong, but it looks like using first case – just doesn’t work. using second case – is a bad idea. so i began to work with sql and posts_where commands. first: instead of $wp_query->query_vars[‘s’] i started to use get_search_query() second: looks like when sql tries to … Read more
filter rest api post by a acf filed
Custom fields are stored in post metadata, which is very expensive (slow) to query. Ideally, you would be better off re-coding the site to use custom taxonomies instead of custom fields. From there, search would be easier. If you stick with ACF or other metadata, you can customize the search form and queries, but you’ll … Read more
I just realized that there was a typo in the code. The meta-tag should read ‘prod_hierar’ instead of ‘prod-hier’. This fixes the issue. (Too much experimenting, I guess ..). Function ‘wms_hierarchy_col_orderby()‘ thus becomes: function wms_hierarchy_col_orderby( $vars ) { if ( isset( $vars[‘orderby’] ) && ‘prod_hierar’ == $vars[‘orderby’] ) { $vars = array_merge( $vars, array( ‘meta_key’ … Read more