Filtering elements by taxonomy slug

Have a look at the documentation for the_terms(). It requires at least two parameters – the post ID, and the taxonomy name. You’re not giving it either of these (I am of course assuming your taxonomy isn’t called taxonomy-name). However, you’re also using the wrong function for the situation. the_terms() is used to display (i.e. … Read more

Is it possible to change slugs’ default behaviour?

Test you the following filter work for you: function wpse245094_fist_duplicate_slug( $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug ) { // slug had to change, we must have a duplicate if ( $original_slug !== $slug ) { // try to replace `-2` with `-es` $new_slug = preg_replace( ‘#-2$#’, ‘-es’, $slug ); if ( $new_slug !== $slug ) … Read more

Custom Post Type to replace Woocommerce products – page not found error

I haven’t tried this myself yet – and I would probably always prefer to go with the default ‘products’ for compatibility reasons… However it should be very well possible to add your own CPT to WooCommerce and then “move” all products to that new CPT. First you’ll have to add a CPT to your WordPress installation that … Read more

Changing CPT slug and taxonomy already registered in parent theme

WordPress 4.5 introduced the functions unregister_post_type() and unregister_taxonomy(). You could deregister your post type respectively taxonomy and register them again with your custom settings. The post type is still named portfolio. You could rename it, but you would probably have to check your template files for references. add_action(‘init’, ‘wpse_247924_overwrite_theme_post_types’, 1000); function wpse_247924_overwrite_theme_post_types() { unregister_post_type( ‘portfolio’ … Read more

Is it possible to create slug on homepage and how?

What you are asking would make those pages NOT be the home page, at least in WordPress’s definition of the homepage. If you want people to go straight to /some-page and not be able to access the root, then you would create a 301 redirect for this (but there will still technically be something on … Read more

Get term slug by term id and then explode it

I guess the problem is here. $slug = $term->slug; $explodedSlug = explode(‘-‘, $_slug); you are passing an undefined array $_slug to explode function. the correct array is $slug. so your complete code should be something like below. function revised_featured_courses_query() { $meta_query = WC()->query->get_meta_query(); $tax_query = WC()->query->get_tax_query(); $tax_query[] = array( ‘taxonomy’ => ‘product_visibility’, ‘field’ => ‘name’, … Read more

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