Search custom post type posts only by meta fields?

This might work, not tested though. First add this to join the postmeta table: add_filter( ‘posts_join’, ‘search_filters_join’, 501, 2 ); function search_filters_join( $join, $query ) { global $wpdb; if ( empty( $query->query_vars[ ‘post_type’ ] ) || $query->query_vars[ ‘post_type’ ] !== ‘product’ ) { return $join; // skip processing } if ( ($this->is_ajax_search() || $this->is_search_page()) && … Read more

How to display *block number* instead *date value* on WordPress posts?

I have no idea what a ‘block number’ is, but when themes output the date for a post they will use either the_date() or the_time() (or both). You can replace the output using the filters the_date() or the_time(): add_filter( ‘the_date’, function( $the_date, $format ) { $block_number=”whatever a block number is”; return $block_number; }, 10, 2 … Read more

Custom Sort Order for Custom Post Type Taxonomy

Use usort with a custom callback, like this: function compare_term_order_numbers( \WP_Term $a, \WP_Term $b ) : int { $order_number_a = get_field( ‘order_number’, $a ); $order_number_b = get_field( ‘order_number’, $b ); return strcmp( $order_number_a, $order_number_b ); } usort($terms, ‘compare_terms’ ); Note that this assumes get_field returns a plain string, not an object, that each term has … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)