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
- Remove slug of multiple custom post types with and without hierarchical
- How to Remove all Instances of edit_post_link
- How to count the length of a post title?
- Hide a menu-item and its submenus and display a ‘Log in’ link if the user is logged out
- Result of Custom WP_Query appears on 404 Page (but result are found!)
- Is it recommended to pass some data to scripts in `wp_enqueue_scripts`?
- if file_exists not working with wp_enqueue_style
- WordPress WP_Query() Not working properly
- How to speed up admin-ajax.php in wordpress
- My Own layout in WooCommerce pages [closed]
- Ajax call return 404
- Display WordPress Post Content in 3 Columns
- src script only works on home page?
- Should I use WordPress to skin a database website?
- wp_delete_comment takes two tries to delete – then deletes all comments
- Array to string conversion on array_map
- Target post_date_gmt if it’s empty or not set
- Remove page title in product page using a function
- woocommerce specific quantities for product
- Menu Custom Data Attributes
- Separate array output into a
- How to add new CSS file to new PHP file
- WP_Query and help with the loop for magazine front page
- Why does PHP called with Jquery AJAX not allow additional php code to be added?
- Generating 10 000 WordPress posts using PHP and avoiding Server Timeout error
- Updating user meta adds string count to value?
- Woocommerce Product page add on checkbox and price
- Sum All the Post Meta of Published posts of Current Logged in user
- Page template not working when logged out
- WordPress child theme, creating a custom php template page
- How to block access to a folder inside of wp-content for non logged in users?
- Ordering / grouping posts by datepicker ACF
- Only Get A Certain Number of Posts From WP_Query
- Even with PHP plugin get_posts not working in widget area
- how to add number value in front for variable [closed]
- Use custom get results query to show posts WordPress
- echo variable containing html and the_permalink();
- Search in particular category in wordpress
- Problems With Query and/or Template Part and/or PHP
- Add Custom Post Type on the Fly or create an array
- What’s the best way to format ACF number fields for display on the front end?
- Create an unique ID number after submit form
- static array on functions.php
- How to implement a custom sliding banner? [closed]
- undefined variable in php
- Function for Post Creation plugin for Gravity Forms
- success Message not Displaying
- child category under correct parent