Thank to @Milo I was able to solve this
1) Delete anything that might be reserving /blog/
url. In my case, It was a singular page with URL /blog/
.
2) Modify custom post type declaration so it has 'has_archive' => true
3) Create archive-blog.php
and move your code here. (You can just use global query object for this custom post type)
4) Refresh permalink few times by settings it back to plain to custom (It actually refreshes your URL permalink.
5) Works.
Related Posts:
- How can I modify the permalink via a filter?
- Newbie question: no index.php? in my plain wordpress permalink
- Change links automatically to affiliate links
- Rewrite sub folder dynamically with country code in WordPress using PHP
- Use WordPress’ URL rewrite engine
- Rename “Portfolio” slug?
- How to rewrite URL with PHP variables with htaccess to a normal looking URL?
- Static variable and add_rewrite_rule?
- Nesting if statements to echo only one string based on what tag was filtered?
- How to change home or site url using action hooks or filter?
- Why do WordPress rewriites seem to work differently for posts vs pages?
- Performance impact of rewriting WordPress URLs
- Is sanitize_title_with_dashes formatting function too liberal (in terms of accepted characters)?
- Changes in permalink structure in WordPress and how to apply to in-site links
- WordPress Persistent connection rule does not work for “posts”
- Append query string to all URL’s
- custom rewrite rule help! Custom rewrite rules not applying to custom post type
- subdirectory index.php is not working
- Use URL Rewrite as well as $_GET parameters in URL?
- How to modify URL (add GET values) after front end form submission?
- parts of url disappear when using # inside href=”” [closed]
- Create custom permalinks to show Custom Post Type’s relationship?
- Add .htm extention to a custom taxonomy
- Help with .htaccess and Login with Subfolders
- WordPress add_rewrite_rules for custom URLs ending in .html
- Rewrite with pagination /foo/page/2/ to posts of a given category, page 2
- Divi change project category slug
- How to add a rewrite endpoint to unattached media?
- How do i add slugs to a URL, but still redirecting to the same page
- Nginx WordPress and another Web app URL structure
- WordPress Rewrite Rule
- Why is home page content not displaying with this rewrite rule?
- Modifying WP URL handing code?
- How to deal with a GET variable of ‘name’?
- How to define a rule in functions.php that ONLY disables the default wp functionality that undesirably changes ‘&’ to ‘#038;’?
- How to pass username in affiliate link in wordpress website
- Test the existence of a page/article by its URL, taking in consideration the URL rewriting by filters
- url not using query string no longer working
- Current WordPress Page Title as Search Parameter into A Tag
- How does one make a URL return dynamic JSON with custom Content Type?
- URL rewrite rule
- How does WordPress rewrite URLS using its PHP scripts
- How can I turn a url with get method as a clean url with segment as the get method?
- WordPress Rewrite Issue
- How to print redirected query string variables to the page?
- Multiple URL from Custom post name
- Why isn’t my custom function kicking in from my functions.php file?
- Difference in Get Variable Location
- WordPress adding in site URL to header links
- Dynamically append custom post type to end of url
- WordPress add parameters with friendly url structure
- Custom taxonomy with page post type – WordPress
- Error Warning: Declaration of description_walker::start_el after PHP upgrade [duplicate]
- WordPress Warning: preg_replace(): JIT compilation failed: no more memory
- Append code into wp-config.php
- How to turn off redirection from ‘domain.com/login’ to ‘domain.com/wp-login.php’
- wp_enqueue_style with style.php and WordPress functions
- How to get bool with `get_option()` when already registered setting with type `boolean`
- PHP code inside shortcodes
- PHP help get_template_directory + PHP include
- Reload part of checkout on changed shipping method
- how to combine wordpress htaccess on my root domain + php on subfolder
- Input data from email form not going to JSON file
- Should `wp_login` be used since it’s deprecated?
- How to use a custom hook
- Hide HTML element (by class or ID) with PHP
- Pagination on Custom Post
- Why can’t I return a value from $wpdb->get var?
- change title page on search result
- Trouble with a php code that adds a log in/log out button [closed]
- How to add aria role and schema markup to custom walker container
- jQuery accordion menu
- Where should I copy a PHP file from wp-includes to, in order to override it in my child theme?
- How to edit wordpress pages through cpanel? [closed]
- Is it possible to restrict files from your wordpress uploads (not logged-in users or guest)?
- Adding attribute to the post.php form tag in wp-admin
- How to get movies by date
- Is there way to toggle the publish date display?
- How to use wp_ajax_set_post_thumbnail?
- Download Featured Image Link in Post Shortcode
- Get product price in a different currency using WooCommerce Currency Switcher
- Cannot fetch posts with certain ‘product_cat’. WP_Query is empty
- Detect what link user clicks and Redirect to a specific page for logged in users only
- Advanced WordPress SQL Query
- Create a hierarchical loop at predefined markup requirements
- Setting ‘post_format’
- Custom Meta Boxes and Fields Multicheck Issue
- nested divs, classes for a grid in loop [duplicate]
- Shortcode to include PHP file, pass various parameters to include?
- Why can’t I include echo inside a variable? [closed]
- WP_Query not returning results
- How to increase excerpt length in wordpress? [duplicate]
- Are WordPress & PHP objectively and based on evidence going to die because the future is made of frontend rendering instead of server side rendering? [closed]
- Not able to see the error [closed]
- How do I link the side images?
- WordPress 6.1.1 UTF8 Slug Limit Increase
- WordPress directories not writable after PHP version upgrade
- How do I unset category from a product in wordpress by code
- Load style and script for custom post type metabox
- Permissions error when I use my plugin to delete comments in the front-end