&& is_post_type_archive('local-attractions')
is_post_type_archive isn’t set yet, WP is still deciding this, hence the call to pre
. Instead use:
_get_posts
&& $query->is_post_type_archive('local-attractions')
The same is true of any other is_
type methods, use the $query
object, else you might be asking these questions about a completely different query and getting confusing results
Related Posts:
- Excluding a Custom Post Type with a specific tag using pre_get_posts
- Custom Post Type shows pagination (w/404) or posts_per_page query, but not both
- Create a custom archive page for a custom post type in a plugin
- Custom Post Type Archive Page not showing
- Custom post type yearly/ monthly archive permalinks
- How to show more posts on an archive page?
- Page is defaulting to archive page and not designated template
- custom post type archive page url to point to Page permalink
- How to get my Custom Post Type to display in Recent Posts using “pre_get_posts”
- Better to use a post type archive, page template, or shortcode for generating a highly configurable CPT archive?
- Add Settings to Custom Post Type
- Custom post type permalink structure with the category also acting as an archive
- Custom Post Type Works but Still Shows “Page Not Found”
- Rewrite custom post type url’s adding meta box values
- I can’t set meta_key in my custom post type query
- Archive page for taxonomy of custom post type
- Add meta data to the custom post type ARCHIVES page
- Can’t sort order of wp_query with 2 meta keys
- Displaying custom post type on category pages but not on blog listings
- Custom post type with tags
- Create Custom Post Type Archive Page with Sub Categories Navigation Sidebar
- Custom Post Type archive giving 404
- pre get posts changing the query
- Custom taxonomy template not working with simple loop. Multiple CPT using the same taxonomy
- Custom query variable – get wordpress to redirect to nice permalink url
- add_rewrite_endpoint() and Custom Post Type Archive
- Custom post type archive page pagination
- Add custom post type archives to search results?
- Second Custom Post Type Archive
- How do I get the permalink structure to work like this?
- is_main_query() not working for WP REST API
- WP_Query | ‘post_type’ doesn’t work
- Editable Meta Data for Custom Post Type Archive Template
- Custom Post Type with has_archive ignores my custom archive and single template
- Archives for Custom Post Types (without Pages)
- Set up Custom-Post-Type Author Archive
- Custom post type templating problem
- Single post with a Custom Post Type returns 404, when archives of the CPT work correctly
- Custom post type archive page blank
- Creating a Custom Post Type
- Custom Post Type slug same as page name
- I am trying to hide a custom post type category to logged in users with Pre_Get_Posts
- Query multiple taxonomies with pre get posts
- Set thumbnail and title for a post type archive (not post itself!)
- How to set up Custom Post Type archive page as Front page
- Custom Permalinks For CPT and pages with parent. Advanced WordPress
- CPT is simply not displayed in the main archive with “pre_get_posts”
- How to integrate single and archive templates for custom post type in any WordPress theme
- ACF for custom post type archive pages: which hook to use?
- Show categories of custom post type and not all posts
- Custom Post Type with Configurable Sidebar via ACF
- Query Posts that have Custom Taxonomy
- Archive page for custom post type and custom taxonomy
- Order Custom Post Type Archive by multiple values in functions.php
- Pagination does not work on Custom Post Type archive while trying to get load more function working
- How to have multiple archive pages?
- Create a Custom Path to Archive
- WordPress sitemap with Custom Post Types
- Is possible register two archive pages for single custom post type?
- Display All Courses in Course Archive Page
- Archive page of CPT’s custom Taxonomy
- Getting Same Description in All the Custom Taxonomy Posts
- Archive page for WordPress Custom Post Type doesn’t show pagination from paginate_links()
- Custom post type archive URLs with a single taxonomy
- Custom post type author issues
- Custom Post Type / Taxonomy not displaying archive
- pagination problem listing custom post types of taxonomy in wordpress
- ACF Pro Accessing fields on a Custom Post Type
- Do not show child pages within a file page
- Display Specific Posts at Start of Loop
- Permalink for custom post type pages not working
- Set archive of custom post type like ‘posts’ page in reading settings is set
- Custom taxonomy with custom post type archive page
- Meta_query by date for Events archive
- pre_get_posts gives 404 error on Custom Post
- Custome post type “tags” pick default archive instead of custom post type archive
- Customize url from the_terms
- Want to display my custom date archive to date.php but dont know how
- Help with Multi Level Category Archive Page
- Highlight a Post on archive page if it has a new comment?
- Display custom post type archive on page.php template
- Pagination fault in custom post type archive page [duplicate]
- Templates list in “Page Attributes” metabox is inaccurate
- Stop Custom post type from being searched via URL
- Permalink of custom post type partly broken
- pre_get_posts not firing at all
- Custom Post Type Archive Links Not Working
- CPT archive as home page
- Archive page of filtered posts
- Why is this custom post type defaulting to archive.php?
- Archive Page Pagination not working
- Custom taxonomy archive page not routing?
- single-mySlug.php works: archive-mySlug.php does not. Custom Post Type
- has_archive for default post type
- Pagination not working for archive
- Pagination for Custom Post Type with Multiple Types
- Custom Post Type Archive Title Lowercase
- Pagination not working only on Archive-Name.php using new WP_Query
- Dynamic WordPress rewrite rules for multiple custom post types
- WordPress CPT archive page display sticky post first and then display the rest of the posts in same Query