How do I add a tag slug to a category URL to filter posts?

Ok, I found a solution. By default in WP there is an option to filter categories by tags. E.g. https://example.com/category_name?tag=tag_name. I added a rewrite rule and redirection: https://developer.wordpress.org/reference/functions/add_rewrite_rule/ add_action( ‘init’, function () { add_rewrite_rule( ‘([a-z0-9-]+)\/tag\/([a-z0-9-]+)\/?$’, ‘index.php?category_name=$matches[1]&tag=$matches[2]’, ‘top’ ); } ); https://developer.wordpress.org/reference/hooks/template_redirect/ add_action( ‘template_redirect’, function () { if ( is_category() && is_tag() && ! empty( $_GET[‘tag’] … Read more

Listing all slugs?

Hi @Wordpressor: Sounds pretty simple so I’m concerned I misunderstand, but in case I did understand correctly here’s a function; just pass the taxonomy to it like this: echo get_taxonomy_list_html(‘category’): function get_taxonomy_list_html($taxonomy) { $term_links = array(); foreach(get_terms($taxonomy) as $term) { if (!empty($term->slug) && $term->count>0) { $link = get_term_link($term,$taxonomy); $term_links[] = “[ <a href=”https://wordpress.stackexchange.com/questions/8326/{$link}”>{$term->name}</a> ({$term->count}) ]”; … Read more

author slug in the backend

Please read the codex on this function. Outside of the loop, your second arg must be a user ID. Inside the loop, WP grabs it from the post data. get_the_author_meta(‘user_nicename’, $userID);

Create “/blog” sub-site on WP multisite network

“blog” is a reserved name within the WordPress system, so you really can’t be using it as you are trying to do. A better solution would be to name the site something else that is a legal wordpress site name, and then use .htaccess to redirect the old links to the new ones.

How to get postname in custom page?

You can use sanitize_title() on the page title: http://codex.wordpress.org/Function_Reference/sanitize_title and then you might try something like this: $my_page_title = “My page name”; $my_page_slug = sanitize_title($my_page_title); // or you can set the slug you want: //$my_page_slug = “my-slug-for-this-page”; $my_page_content = “This is my page content”; // Create page object $my_page = array( ‘post_title’ => $my_page_title, ‘post_name’ … Read more

Don’t change Custom Post Type slug to unique value

you might consider the ‘wp_unique_post_slug’ filter: add_filter( ‘wp_unique_post_slug’,’my_disable_unique_slug’,11,6); function disable_unique_slug( $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug ){ global $post; if($post->post_type==’cpt’){ // EDIT post type $slug=$original_slug; } return $slug; } This is untested, but you get the idea 😉 ps: you might have to change other things to make this work, since the unique-ness is so … Read more

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