Function get_template_part() load file only from theme directory (or child theme).
There is no filter or action hook that would change this behavior.
You will need to write your own get_template_part() variant to load files from the plugin directory (replace the locate_template() call from the original function). Or write an explicit:
$query->the_post();
include plugin_dir_path( __FILE__ ) . 'single-products.php';
Related Posts:
- Where to put my code: plugin or functions.php?
- How to add custom content template part for a custom post type on main query using a plugin
- Make custom post type display as a page
- Form action/link to render a plugin in WordPress front-end
- Modify a plugin function output from another plugin
- Content in WP Editor displayed below CPT shortcode [duplicate]
- How to display the post using a shortcode in WordPress?
- How to seperate posts by categories?
- Custom meta box in editor of custom post type not working
- Shortcode error
- How to separate posts by categories?
- Post URL redirecting to homepage
- How to disable the single view for a custom post type?
- How do I change the author of a custom post type?
- How to add a button to custom post type’s posts-page
- How to add multiple images to custom post type?
- Creating a custom public user page
- Shortcode Displaying Custom Post Types
- How do I Make a custom post type get a custom post template in a plugin
- Create sub single pages
- Remove Slug from Custom Post Type results in 404
- Insert slider (Custom Post Type) into pages
- How do I create a custom post type for a training CMS in WordPress?
- WP Query group/order by category name
- Save or update data when custom post published
- Custom Select Query with Custom Post Types
- How to add multiple featured image in meta box in post editor?
- How do I set the link in the Custom Post Type admin menu?
- How to List Thumbnails based on Custom Categories
- Adding Meta Boxes while Registering a Post Type in a Class
- Set object terms not working on plugin activation
- Using custom page templates with plugin [duplicate]
- pagination redirecting from page number url before page requested
- Need to display same custom post type on 2 different singles templates
- get_template_part and template file names
- How to enable shortcodes in a custom post type?
- How to add a custom taxonomy to show up in a custom post type menu?
- Give a permalink to Custom Post Types without title
- custom post type parsed as attachment
- custom post type category count shortcode
- How to Create a WordPress Plugin With Custom Post Type/Custom Field Features?
- Adding a metabox on a CPT’s submenu page
- Custom fields for custom post type
- Get term name without a foreach loop
- Save Multiple Metabox values
- What’s an efficient way to change the post status of many posts at once?
- How exclude or skip post type with get_next_post_link
- how to create custom post type with dynamic category_name using shortcode
- WordPress Custom Post Type and Shortcode for Portfolio Items
- Creating shortcode id for custom post types
- Custom Post Type for Shortcode Use – Prevent it display as a post (with slug)
- How to call a post’s metadata in shortcode.php?
- Types plugin custom post add_action hooks
- How to display class name in this shortcode post query
- Why is my custom post query shortcode only showing 1 post?
- How do I output a list of a specific post type in a table?
- Limiting Amount of Posts in a Custom Post Type again
- Not Able to Add New Class To CPT Attachment Image
- Auto update publish date of CPT Post if default post custom field value match to cpt post CF Value
- Orderby custom fields is not working
- How to stop the custom post type URL from the google search?
- Create a CPT to edit Shortcodes Atts
- Can Someone help me to create Short Code for displaying a category posts
- Changing CPT permalink
- Get all posts by many custom post types
- Why can’t I filter my CPT shortcode by category?
- editing shortcode for custom post type within a plugin
- Warning , Use of undefined constant PLUGIN_PATH?
- WordPress post not executing shortcode until updated
- Show Post columns to specific users on condition
- Why custom post redirecting to index page?
- Custom Post type plugin is using theme single.php and style.css
- custom post type single page
- custom post type single post preview for pending status
- call a function when insert and update a custom post type
- DIVs not showing correctly on CPT?
- Registering an optional custom post type from a plugin
- Ads below footer
- Modify shortcode to work with custom taxonomies and slugs
- Custom Info Box at end of posts?
- Generate custom RSS from a plugin
- Custom post type single display is ommited
- Single page problem when permalink type changed
- Query child posts on parents single.php?
- Add Excerpt On Quicksand Plugin
- is_singular won’t call my functions?
- Rewrite a filter as shortcode (or something like that) to use anywhere in CPT
- Can I have a specific template for products even if they are standard posts and not CPT?
- Create settings page to enable or disable CPT
- Problem with shortcode
- Make term slugs of custom taxonomy available in WP REST API for custom post type?
- WordPress Multisite Network Shared Custom Post from Main Site using single-CPT.php
- Custom Field in Page Title
- SOLVED: Shortcode to display Divi project filtered by tag in WP Query loop
- Add Shortcode functionality to a function that queries custom post type / taxonomy
- Add block templates (html) via plugin for custom post type
- REST API callback function is not called
- Display box in sidebar of custom post type
- Remove `View post` Text
- Generate list of posts on a page, but fill shortcode values from ACF fields on that page