You won’t get a 404 because WP can find the page, and it then delegates the request to the template file where you added your own logic.
You could build your own 404 handling in that file, but a better way is to use a the archive.php (or archive-post.php for just this post type) to render the output, and use the pre_get_posts action to manipulate the WP_Query that is used to find posts (customize page size). If you’re doing it that way, you’ll find that WP will trigger a 404 correctly if the requested page is greater than the last available page.
Related Posts:
- How WordPress converts URL to $query_string
- How can I use the WordPress Loop and Pagination in multiple instances but different scenarios throughout my site?
- Pagination and multiple loops
- White screen of death on index.php page 3 and above?
- control posts order by select option
- Why when I submit a form in wordpress it loads a 404 page though URL is correct
- Get ‘page’ number with infinite scroll
- Get 10 posts from a WP_Query. If less than 10, get the remainder from elsewhere
- Why doesn’t /2013/01/ properly return January’s archives in archive.php?
- Different wordpress 404 template for different post type [duplicate]
- Get the number of posts from the current page results
- Strategy to get post meta for use outside the loop
- How to display wp_nav_menu() conditionally only when not on a 404 page?
- Grab the first paragraph of each post
- Single Page WordPress Theme – Using page templates
- A two column loop with one lead post
- Pagination & get_pages?
- Change loop order via form or link (jquery, not URL)
- First post of each category
- Is there any need to use both wp_reset_postdata and wp_reset_query together?
- query posts in wordpress
- Getting Permalink within the loop
- the_content() in single-{post-type}.php problem
- Why does this loop only work on the homepage?
- Pagination with custom post types results in 404 issues
- Setting hero/splash section as a blog post
- posts_nav_link(); not showing up on static pages
- How to retrieve an image from a post and display it before excerpt of a post? [duplicate]
- Paging on a future post loop?
- Any tag pagination page (except the 1st page) loads index.php template instead of tag.php
- Finding Page Template and Displaying Content
- Adding default pagination to wordpress loop
- Why is the first query affecting the second query, even after wp_reset_query() and wp_reset_postdata(), but not on the second page?
- Link won’t show using the_permalink();
- Some doubts about how to show posts in a custom theme?
- Force index.php have_posts() loop to exit if no sticky posts found
- WordPress 404 page returning with default in IIS7
- WordPress with broken paging page 3
- show a post from a specific post format
- Displaying recent post excerpts on static front page
- Conditional statement to show pagination
- Limit Loop to 5 Posts?
- How to show user online status on their posts?
- WordPress Theme’s 404 File Getting Called Every Page Load?
- Custom get_the_excerpt() only works on first post
- Echo all category names, apart from one
- how to get the post attachement image in full size?
- Get the amount of posts on a given page
- How to list articles by year based on url?
- I used single quote to design HTML of my WordPress blog. Now site redirects to index.php everytime than page.php or single.php
- Custom WP_Query always respond with 200 status even when no entry
- wordpress 404 not found after rewrtie the author link
- Change image size depending on page
- pagination for a custom loop with multiple post types
- How can I prevent posts with no title showing up in my query?
- What template file is used for homepage pagination?
- Previous and Next links not populating, have I missed something?
- Twenty Seventeen Pages Loop
- How does the loop know which post to view?
- Pagination fuction in shortcode always displays on top
- Pagination not working on custom post page
- Retrieve WordPress’ the_content() with jQuery
- Exclude subcategory from wp_query
- Style first 3 posts differently with WP_Query [duplicate]
- WP_Query not getting all posts, just tagged posts
- first excerpt fine, subsequent post excerpts shift to the right instead of displaying vertically [closed]
- Page not found yet the posts are listed?
- How can I sort my loop based on meta data, using a form?
- List categories of a post hierarchically?
- Exclude parent categories from the_category() within the loop
- How to know if I am on 1st page
- Pagination don’t work with active filters
- get_the_terms() returning wrong results inside of loop
- Show the number of the post
- Show only pages you are author of
- Add class every 4 post like , class_1, class_2, class_3, class_4 and class_1, class_2, class_3, class_4
- How do I make my terms for each product display via foreach loop? (woocommerce)
- WordPress Insert ads after every 5th post
- WordPress theme files Organization
- How to implement pagination in category.php template
- Infinite loop when nesting have_posts()
- Local variable name in setup_postdata()
- Problem with pagination link (error 404)
- Numbered Pagination Showing The Same Posts After Altering WP_Query
- Loop is breaking my theme. How can I fix?
- Custom post type query with pagination doesn’t work
- How to Show Next, Previous, and Page Numbers with wp_link_pages
- my ajax wont sent the data, please correct my code
- Problem with Displaying Custom Theme Page’s Content
- Why content is not adding for each blog post
- Second page of archive is empty
- 2 custom posts types, in their own columns, one pagination for both
- How to Apply Category Filter to Pagination
- Best way to allow for extended use of WordPress functions inside single.php
- Detect error 404 page to find out the issue
- Conditional loop based on current page
- Loop through all posts, show attachment if there
- Suppress the_content filter in a nested loop
- Tags interfering with next_post_link();
- Simple loop with shortcode rendering problem