How can I get next/ previous post links to order by a filter (by the last word of the title)?

Reviewing the MySQL string functions, it looks like you could use the SUBSTRING_INDEX() function: ORDER BY SUBSTRING_INDEX( p.post_title, ‘ ‘, -1 ) {ASC|DESC} LIMIT 1 to order by the last word of the post title. You could test this method within your orderby filters. Example: Prev/Next CPT – ordered by last word in post title … Read more

The Operator “NOT IN” Does Not Work In tax_query

I suspect you need an array for the terms – although I’m not sure why it would work with “IN” and not with “NOT IN”… But I’d try this: function menta_pre_get_posts( $query ) { if ( !is_admin() && $query->is_search() && $query->is_main_query() ) { $term = get_term_by(‘slug’, get_query_var(‘s’), ‘product_tag’); if ( $term && !is_wp_error( $term ) … Read more

Getting “The link you followed has expired” when adding custom post [closed]

The “The link you followed has expired” message is in the function wp_nonce_ays on line 2607 of wp-includes/functions.php. Apparently, the message was changed from “Are you sure you want to do this?” in 4.9.5. The wp_nonce_ays function is called by check_admin_referer if the nonce check fails. This is the only place in the WordPress code … Read more

Query Custom Post Type taxonomy type based on page

To make that more efficient, instead of arguing the current page slug, you just place the current slug as the tax_query’s terms value. Something like: global $post; $args = array( ‘posts_per_page’ => -1, ‘post_type’ => ‘books’, ‘post_status’ => ‘publish’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘book_category’, ‘field’ => ‘slug’, ‘terms’ => $post->post_name, // which’d be … Read more