You can achieve it with pre_get_posts
. With your current code there are multiple syntax errors. You have write it this way
add_filter('pre_get_posts', 'limit_change_posts_archive');
function limit_change_posts_archive($query){
if ( !is_admin() && $query->is_main_query() && is_archive() && is_tax( 'pdsh_categories' ) && is_term( 1858 )) {
$query->set('posts_per_page', -1);
}
return $query;
}
As is_term
is deprecated a different approach can be like this:
add_filter('pre_get_posts', 'limit_change_posts_archive');
function limit_change_posts_archive($query){
if ( !is_admin() && $query->is_main_query() && is_archive() && is_tax( 'pdsh_categories', 1858 )) {
$query->set('posts_per_page', -1);
}
return $query;
}
Again this above code needs to be tested.
Related Posts:
- How to use a custom post type archive as front page?
- CPT archive admin menu label
- How to add specific terms in a custom post type?
- Pagination fault in custom post type archive page [duplicate]
- Custom Post Types using wrong template (index) instead of archive-{type}.php – previously worked as expected
- On update or create post redirect to current post position in list
- I need to add endpoint for wordpress categories
- Use Custom Post Type archive page for the taxonomies term archive page
- How to target a specific custom post type post and its all children and grandchildren?
- Display custom post type category, while in a CPT category, then the posts beneath
- Featured image overlay when changing post status
- get_post_meta not working on publishing
- Redirect 404 page with ID in slug to associated page with same ID in slug
- WordPress wrapped added a span tag to every single p tag
- ACF field key/value to show on taxonomy list
- Re-registering a custom post type not working (not showing up)
- Display featured image from one CPT within another CPT query
- Query taxonomy of taxonomy of custom post type
- Best way to style first post differently?
- How to make custom posts types display when published for the future
- How to rewrite url for any specific taxonomy?
- Single post with a Custom Post Type returns 404, when archives of the CPT work correctly
- create a new page from a custom post type similar to an authors page
- Anon function and add_meta_box
- Number of Custom Post Types published are not being shown in the custom page
- Custom post type archive page blank
- Custom Post Type has_archive
- Custom Post Type Archive URL is wrong
- Hide a widget inside a div on specific type of post
- Creating a Custom Post Type
- Shortcode not working with post counter
- Changing default ‘posts’ parameters with register_post_type_args
- Custom Post Type slug same as page name
- How to display custom post in archive section of the wordpress page?
- Content Editable CPT Archive?
- list archives per post types
- Homepage’s content is dependent on the custom field values (set automatically), how do I get homepage to update without manually updating page?
- Canonical url differs from custom post type archive URLs
- Cannot save CPT meta box
- Display a custom posts page for post type
- Custom post type archive pagination 404
- Allow users to create posts without logging in?
- How to change permalink to include custom post type
- posttype/taxonomy/term archive page 404 error
- Is it possible to have a custom post type with feed but without the archive?
- Configuring a meta query with multiple post types that have the same relationship on a single page
- Add term to custom post type on draft
- How to assign classes to all elements?
- Ignoring slug capitalization on rewrite rule for custom post type archive page
- next_/previous_post_link() `in_same_category` appears to fail when true
- Want to be able to sign up subscribers as authors
- Load scripts based on post type
- Paginate_links in custom post type template
- Different Category system needed for the Custom Post Type
- My archive-posttype.php template is not loading
- Global custom meta box
- Template not working for the custom Post type
- Custom Post Archive is not working
- Warning: Invalid argument supplied for foreach() [closed]
- Custom post type isn’t working
- Meta-Boxes for CustomPostType cause PHP Errors and Notices in “Add New” view
- Limit the Title Length on Custom Post Type Archive Page to a Set Number of Characters
- Custom post type archive with page as parent url
- Add parent post to Custom Post Type [closed]
- categories should be available across all custom post types
- Set featured image to archive.php
- Warning: Invalid argument supplied for foreach() in post.php [closed]
- Featured Image field not appearing in Custom post type
- Post-thumbnail only for specific post-types?
- custom post type metaboxes not saving
- Custom Post Type & Custom Menu Walker to append custom class for active post types
- Enable taxonomies by post type in an array of CPTs
- What’s the name of the custom post type yearly archive template?
- Custom post type, global categories — what’s the template name?
- PHP question: how to combine syntax?
- How to hyperlink content from archive page with custom post-type
- Loop increase number
- custom post for slider
- Set thumbnail and title for a post type archive (not post itself!)
- ACF in wordpress
- How to set up Custom Post Type archive page as Front page
- Url to archive page for custom post type
- How can I use archive-{post_type}.php theme template?
- Change Slug of a Custom Post Type
- How to display CPT archives?
- Excerpt function for any content
- Assign category a default post type
- Custom meta Title for custom post type archive from page
- Navigate posts with different post type that are in the same categories
- Excluding a Custom Post Type with a specific tag using pre_get_posts
- Return the name of the post type
- List of all entries of custom-post-type: Add year-parameter?
- Add an Outside Wrapper to my Header and Make it Full Width
- Page Template Dropdown For Custom Post Types
- Showing custom post type categories in the menu
- How to use a variable as a function name?
- current-menu-item not added on page showing custom post type (rendered with archive template)
- Show Custom Message in WordPress Admin
- Alphabetically sort a taxonomy.php template by post title
- How to inherit field value from parent post into in child / sub post