Reuse View shortcode (add parameters)

This feature is only available in the Pro version.

You should not reuse the views that enabled Live Filter, Shuffle Filter. Because these features don’t support the below parameters.

Replace “VIEW_ID” below with ID of the View that you want to reuse.

Since version 4.4.0, you can use this feature to show related posts, and show current post’s data.

Reusing helps you to use an existing view for similar purposes, without creating new views. It saves you a lot of time & effort.
You can reuse a View by using the View shortcode with extra parameters.
These are available parameters:

  • reuse_tax_query: reuse taxonomy settings of the existing View while adding extra parameters (cat, tag, taxonomy, taxonomy2, terms, terms2).For example: You have a view VIEW1 that filters posts IN category A. If you want to show posts IN category A, but NOT IN category B, this shortcode will help:
    [pt_view id="VIEW1" reuse_tax_query=1 cat="B" operator="NOT IN"]
  • cat: slug, name, ID of categories to filter.For example: you have a category with name “People”, slug “people”, ID 10.
    To show posts in this category, you can use one of these shortcodes:
    [pt_view id="VIEW_ID" cat="people" field="slug"]
    [pt_view id="VIEW_ID" cat="People" field="name"]
    [pt_view id="VIEW_ID" cat="10" field="id"]
  • tag: slug, name, ID of tags to filter

    // Show 5 posts by tag slugs
    [pt_view id="VIEW_ID" tag="foo,bar,content" limit=5]
    // Show posts by categories & tags
    [pt_view id="VIEW_ID" cat="cat1,cat2" tag="foo,bar"]

  • taxonomy: slug of the taxonomy to filter (use taxonomy2 for the second taxonomy).

    To find the slug of a taxonomy, please look at the address bar of the browser when you visit the taxonomy page in Admin area:

  • terms: slug, name, ID of taxonomy terms (use terms2 for terms of the second taxonomy).

    To find the slug of a term, please open the Category or Tag or Taxonomy page, then find value in the Slug column.

    To use the assigned term of the current post, please use the value “GET_CURRENT” (read more).

    To get the current term in its archive page, please use the value “GET_CURRENT_TERM”.

  • field: “slug” (default), “name”, “id”.

    If you use the name (or ID) of categories, tags, terms for the cat, tag, terms parameter, you must use field="name" (or field="id"). Otherwise, it will return “No posts found”.

  • operator: “IN” (default), “NOT IN”, “AND” (use operator2 for operator of the second taxonomy).
    IN — show posts which associate with one or more of selected terms
    NOT IN — show posts which do not associate with any of selected terms
    AND — show posts which associate with all of selected terms
  • relation: “AND” (default), “OR”.
    AND — show posts which match all settings of all taxonomies
    OR — show posts which match one or more settings of taxonomies
  • author: ID of authors (since version 3.2)
    [pt_view id="VIEW_ID" author="10,15"]
  • post_type: Slug of the post type to filter (since version 3.2)
  • limit: number of posts to show (since version 3.5)
  • offset: number of posts to skip (since version 3.5)
  • post_parent: ID of the parent page (since version 3.6.0).
    IDs of multiple parent pages, separate by commas (since version 5.3.4).
  • keyword: keyword to search for (since version 3.9.0)
    [pt_view id="VIEW_ID" keyword="test"]
  • post_id: list of post IDs to show (since version 3.9.0)
    [pt_view id="VIEW_ID" post_id="1,2,3"]
  • custom_field_value: set another values for the selected custom fields in the View.

    // Set new value for 1 custom field in the View
    [pt_view id="VIEW_ID" custom_field_value="NEW_VALUE_HERE"]
    // Set new values for multiple custom fields in the View
    [pt_view id="VIEW_ID" custom_field_value="NEW_VALUE_FOR_FIELD_1,NEW_VALUE_FOR_FIELD_2"]

    For example, in VIEW1 you filtered events have custom field _EventVenueID equals 10. Now you want to filter events have _EventVenueID equals 20, you can use this shortcode: [pt_view id="VIEW1" custom_field_value="20"]

    >> It requires that the “Value To Compare” field in existing View is not empty:
    CVP - reuse custom field


To find value for term, term2 => please check here.

To find value for taxonomy, taxonomy2 => please check here.

// Show WooCommerce products by Categories
[pt_view id="VIEW_ID" taxonomy="product_cat" terms="foo,bar"]

// Show WooCommerce products by Tags
[pt_view id="VIEW_ID" taxonomy="product_tag" terms="foo,bar"]

// Show WooCommerce products by Attributes
[pt_view id="VIEW_ID" taxonomy="pa_another_attribute" terms="foo,bar"]

// Show posts match the filter settings of the VIEW1, but does not have category “foo”
[pt_view id="VIEW1" reuse_tax_query=1 taxonomy="category" terms="foo" operator="NOT IN"]

// Show posts have category “foo” but NOT have category “bar”
[pt_view id="VIEW_ID" taxonomy="category" terms="foo" operator="IN" taxonomy2="category" terms2="bar" operator2="NOT IN"]

// Show posts have category “foo” but NOT have tag “bar”
[pt_view id="VIEW_ID" taxonomy="category" terms="foo" operator="IN" taxonomy2="post_tag" terms2="bar" operator2="NOT IN"]

// Show posts of multiple tag IDs & posts must have all selected tags
[pt_view id="VIEW_ID" tag="1,2,3" field="id" operator="AND"]

// Show posts of custom taxonomy
[pt_view id="VIEW_ID" taxonomy="testimonial" terms="foo,bar"]

// Show posts IN multiple taxonomies
[pt_view id="VIEW_ID" taxonomy="testimonial" terms="foo,bar" taxonomy2="customer" terms2="too,tar"]

// Show posts IN one taxonomy, and NOT IN another taxonomy
[pt_view id="VIEW_ID" taxonomy="testimonial" terms="foo,bar" operator="IN" taxonomy2="customer" terms2="too,tar" operator2="NOT IN"]

Thank you,

Scroll to Top