Permalinks Question: Adding a prefix ONLY in front of the posts

1) Add this rewrite at the end of you function.php function add_rewrite_rules( $wp_rewrite ) { $new_rules = array( ‘YOUR_PREFIX/(.+?)/?$’ => ‘index.php?post_type=post&name=”. $wp_rewrite->preg_index(1), ); $wp_rewrite->rules = $new_rules + $wp_rewrite->rules; } add_action(“generate_rewrite_rules’, ‘add_rewrite_rules’); function change_blog_links($post_link, $id=0){ $post = get_post($id); if( is_object($post) && $post->post_type == ‘post’){ return home_url(‘/YOUR_PREFIX/’. $post->post_name.”https://wordpress.stackexchange.com/”); } return $post_link; } add_filter(‘post_link’, ‘change_blog_links’, 1, 3); 2) … Read more

How to create a permalink structure for posts in a specific category

I am not sure if this is the best solution or not, but it works: function movie_review_permalink( $url, $post, $leavename ) { $category = get_the_category($post->ID); if ( !empty($category) && $category[0]->slug == “test” ) { //change ‘test’ to your category slug $date=date_create($post->post_date); $my_date = date_format($date,”dmY”); $url= trailingslashit( home_url(“https://wordpress.stackexchange.com/”. $category[0]->slug .”https://wordpress.stackexchange.com/”. $post->post_name .’-‘. $my_date .”https://wordpress.stackexchange.com/” ) ); … Read more

Pretty Permalinks

You should add your own custom query variable first: function add_search_store_query_var($vars) { $vars[] = ‘search_store’; return $vars; } add_filter( ‘query_vars’, ‘add_search_store_query_var’); And then add rewrite rule: function add_search_store_rewrite_rule() { add_rewrite_rule(‘stores/([^/]+)$’, ‘index.php?page_id=<YOUR SEARCH PAGE ID>&search_store=$matches[1]’, ‘top’); } add_action(‘init’, ‘add_search_store_rewrite_rule’); You can then use get_query_var(‘search_store’); to get search term. Just remember to flush rewrite rules, before you … Read more

Custom post type by ID in root folder

Try creating a custom rewrite rule and a custom rewrite tag. This should allow you to set up a regular expression to capture the ID and manipulate the query. Rewrite API/add rewrite rule « WordPress Codex https://goo.gl/kdEJd8 Rewrite API/add rewrite tag « WordPress Codex https://goo.gl/PVLzLh

Deleted Page Still In WordPress Database

There is a function that is looking for duplicated post names: wp_unique_post_slug. In this function are few queries, and one of them is looking for duplicated post names: SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type = %s AND ID != %d LIMIT 1. If this query will return some rows then function … Read more

Broken wordpress permalinks on pages only

Do you have a custom post type? This is exactly the kind of behavior you will see from have a custom post type with a slug that matches the slug of your pages. For example, if you have a page called “portfolio” and a post type called “portfolio”, both with a slug of “portfolio”, 404s … Read more

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