function comment_author_id($query) {
$author_id = get_query_var( 'hotel_name' );
if ($author_id) {
$query->set('author', $author_id);
}
}
add_action( 'pre_get_posts', 'comment_author_id' );
Related Posts:
- Not able to see CPT archive template
- Add archive/category results to single post page
- Custom Post Type Archive template not being called
- How to display archive page posts based on author_id
- Need equivalent of single_term_slug
- Finding the CPT archive template source
- Custom Post Type Archive – archive.php is present, but it is not being used
- Permalink Rewrite with Archive – Archive gets 404
- How to create archive child pages with good Yoast SEO meta?
- Custom Post Type Settings page, choose page to display archive
- Meta_Query as a way how to setup CPT permalinks – is it a good thing?
- Custom Post Type Archives by Date with Custom Permalink
- Make Two Views of Post Type Archive At Two URLs
- Change number of posts to show on Archive page (custom post type)
- Update Old Links To Pretty Permalinks Custom Post Type
- Showing only future posts in archive based on custom field date
- Custom taxonomy template not working with simple loop. Multiple CPT using the same taxonomy
- How to remove current year from wp_get_archives
- WordPress custom post type archive with description
- Custom post type and taxonomy permalinks – Structure
- Archive template
- How do I get the permalink structure to work like this?
- Archive list for custom post type categories
- Check if is post type archive and in category
- Custom template won’t load for a custom post type (custom permalinks used)
- WordPress subcategories return 404 in custom template
- Create Archive Page with Visual Composer
- Custom post type is showing custom home page, not archive page
- Custom Post Type Yearly Archive Permalinks
- Custom post type archive page blank
- How to display an other custom post type in a different custom post type’s archive?
- Custom post type archive pagination 404
- Ignoring slug capitalization on rewrite rule for custom post type archive page
- Custom Post Type Archive template page not found
- My archive-posttype.php template is not loading
- Custom Post Archive is not working
- WordPress alphabetical A-Z custom post type post result display
- How to hyperlink content from archive page with custom post-type
- How to integrate single and archive templates for custom post type in any WordPress theme
- Permalink problems with custom post type and custom taxonomy
- Not able to see archive page of custom posts
- How to get the Custom Post Type Archive inside a folder
- Archive Custom Post Type
- Custom Post Type archive (archive-{post-type}.php) is not working
- Custom Post Type with Configurable Sidebar via ACF
- Using WP_Query how can I show events (a custom post type) that are in the future?
- Archive-Custom-Post-Type order by Event Date, ASC, and hide events that have completed
- Custom post type category permalinks and archive pages
- Permalinks that go to a specific template
- Pagination does not work on Custom Post Type archive while trying to get load more function working
- How to make different urls for some tags pages
- Is possible register two archive pages for single custom post type?
- Custom post archive page not opening 404 page
- Archive page of CPT’s custom Taxonomy
- What code do I “comment out” to remove the loop from this Custom Taxonomy
- Why is my archive page looping through all but one post?
- ACF Pro Accessing fields on a Custom Post Type
- Permalink for custom post type pages not working
- Group Archive list by posts tag
- Pagination not working past page 3 on archive page of category
- Change Title Based on Taxonomy Filter in archive-{cpt}.php
- Custom Post Archive – display page 1 differently then subsequent pages
- CountUp timer for custom post
- get first limited words from a custom post in the archive page
- Permalinks custom base to redirect to archive.php
- How to display archive by selecting year and then selecting month
- Custom taxonomy return 404
- Show index and not the archive for “Dog Custom Post” with default slug
- Custom post type archive page not showing on archive-posttype.php
- Custom post type with two templates
- How do I make my archive page look like popular reviewing sites (e.g., Polygon and Gamespot) [closed]
- Display custom post type archive on page.php template
- Multiple archives for cpt, taxonomies, terms
- Making a archive gallery page for a custom post type which already has an archive page
- Custom taxonomy in custom post type archive with pagination
- Custom post type archive url when post type has archive string
- How can I get WordPress CPT archives and page templates to work with prettified permalink settings?
- WordPress Archives Cause Looping
- Permalink of custom post type partly broken
- Custom Post Type Archive Links Not Working
- Have two (permalinks) urls for a same custom post type
- get custom post archieve by month
- Displaying categories items among posts
- Customing Annual Archive plugin
- Using post type archive page for taxonomy archive
- How to have a dynamic slug and rendering the archive-{post_type}.php?
- URL rewrites af
- Notice- undefined variable post and trying to get property of non-object
- WordPress Rewrite Url with arugments
- Pagination not working only on Archive-Name.php using new WP_Query
- How to link to an archive-special.php from a custom front-page template?
- Add custom display condition to Elementor Theme Builder for custom taxonomy children, grandchildren, and great-grandchildren
- WordPress CPT archive page display sticky post first and then display the rest of the posts in same Query
- Archive page for custom post type shows regular posts, too (by category)
- Cannot create custom post types with a specific name
- How to return custom taxonomy term in title for archive?
- Permalinks in WordPress not working
- how to change a wordpress home page permalink as referenced in submenu links
- Is it possible to get a page link from its slug?
- How to get URL of current page displayed?