Support » Plugin: Toolset Types - Custom Post Types, Custom Fields and Taxonomies » Only see posts with status "publish"

  • Resolved Miguel López


    When you create a new post using relation n-n, the plugin uses a select with other posts. This select have all posts, if a post have “trash” status, also show, and this I think it’s a bug.

    I found a solution in post-relationship.php changin the query for function get_posts.

    NOW: $items = get_posts( ‘post_type=’ . $type . ‘&numberposts=-1&post_status=null&order=ASC&orderby=title&suppress_filters=0’ );

    SOLUTION: $items = get_posts( ‘post_type=’ . $type . ‘&numberposts=-1&post_status=publish&order=ASC&orderby=title&suppress_filters=0’ );

    The path for file is: types/embedded/includes/post-relationship.php

Viewing 4 replies - 1 through 4 (of 4 total)
  • Dear atallos,

    Please explain little more for better understanding.

    [ Signature moderated. ]


    I will explain with an example. I have two custom posts type created: Products and Persons. One product need to be associated with one person. When I add a new product, I need to choose which person I want to associate with the product.

    Your plugin show a drop down select with all persons I have created. The problem is if I have created a person and delete it, this person (post) is in wordpress with status “trash” and not “publish”, but it still appears in the drop down select. In this drop down of persons, the correct thing will be to show only the posts with status “publish” and not the deleted items.

    I think the solution is checking the post_status in the query to be sure you show only posts which are published.

    Dear atallos,

    Thank you for the details and I can replicate it. We will fix the issue in upcoming release.

    [ Signature moderated. ]

    Thanks for your great plugin!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Only see posts with status "publish"’ is closed to new replies.