WordPress.org

Ready to get started?Download WordPress

Forums

Types - Custom Fields and Custom Post Types Management
[resolved] Only see posts with status "publish" (5 posts)

  1. donmik
    Member
    Posted 1 year ago #

    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

    http://wordpress.org/extend/plugins/types/

  2. mbigul
    Member
    Plugin Author

    Posted 1 year ago #

    Dear atallos,

    Please explain little more for better understanding.

    [ Signature moderated. ]

  3. donmik
    Member
    Posted 1 year ago #

    Hi,

    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.

  4. mbigul
    Member
    Plugin Author

    Posted 1 year ago #

    Dear atallos,

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

    [ Signature moderated. ]

  5. donmik
    Member
    Posted 1 year ago #

    Thanks for your great plugin!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.