How to fix a double slash in custom permalinks with hierarchical taxonomy’s?

There is a quick and somewhat dirty potential solution to this. I say ‘potential’ because I can’t spot the problem by looking at the code. I only have my suspicions. Instead of passing a separator like that. Try trailingslashit. } else $chain .= trailingslashit($name); return $chain; I am guessing at where the problem is based … Read more

How to show term-specific post list, without posts associated with child terms?

As @Milo’s pointer said, this: Sadly, is normal WordPress behaviour. Can be suppressed using parse_tax_query and include_children set at 0… The code found in the answer at https://wordpress.stackexchange.com/a/202773/39300 Works for me… function taxonomy_archive_exclude_children($query){ $taxonomy_slugs = [‘product_category’, ‘application_category’]; if($query->is_main_query() && is_tax($taxonomy_slugs)){ foreach($query->tax_query->queries as &$tax_query_item){ if(empty($taxonomy_slugs) || in_array($tax_query_item[‘taxonomy’], $taxonomy_slugs)){ $tax_query_item[‘include_children’] = 0; } } } } add_action(‘parse_tax_query’, … Read more

Custom permalinks – post type – hierarchical taxonomy’s

Thanks for referencing my solution. You forgot one part though – defining the rewrite of your cpt. From my solution: First get your slugs right when defining your custom post types and taxonomies: for the custom post type it should be basename/%taxonomy_name% and the slug for your taxonomy should be just basename. Dont forget to … Read more

How to only show posts on last child category

There is of course the include_children parameter for WP_Query as part of the taxonomy parameters. Which I suppose should work like this for you: $args = array( ‘tax_query’ => array( array( ‘include_children’ => false ), ), ); $query = new WP_Query( $args ); Or via parse_tax_query for your category archive: add_filter( ‘parse_tax_query’, ‘wpse163572_do_not_include_children_in_category_archive_parse_tax_query’ ); function … Read more

How to check if last uri segment is a custom post type or taxonomy term?

To see how we can make this work, have a read through the Query Overview Codex page, particularly the What Plugins can Modify section: Modify the query specification, after variable values are saved (request filter or parse_request action; if you want to use conditional tag tests, use the parse_query or pre_get_posts action, as these run … Read more

Easy way to process search results before displaying

You can use pre_get_posts filter to filter out what you need. There’s an example on how to do this in Codex: https://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts#Exclude_Pages_from_Search_Results function search_filter($query) { if ( !is_admin() && $query->is_main_query() ) { if ($query->is_search) { $query->set(‘post_type’, ‘post’); } } } add_action(‘pre_get_posts’,’search_filter’); Also, this article might get you in the direction of editing the search form…

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