WordPress.org

Ready to get started?Download WordPress

Forums

Posts 2 Posts
2 Bug Reports (10 posts)

  1. Derek Perkins
    Member
    Posted 3 years ago #

    Using the plugin API, I have found two errors.

    1) p2p_is_connected - This returns true if the first parameter is connected to anything, regardless whether it is connected to the second parameter.

    2) p2p_connect - I am connecting two custom post types, but the reciprocal argument isn't working in the ui. If I call it as p2p_connect( cpt1, cpt2 ), it doesn't show up in the UI, though it is stored correctly and returned correctly using query_posts. If I reverse the arguments however and call p2p_connect( cpt2, cpt1 ), it does show up in the UI.

    Thanks for a great plugin!

  2. scribu
    Member
    Plugin Author

    Posted 3 years ago #

    The first issue is now fixed in the development version (0.5.2-alpha). Thanks for reporting.

    As for the second issue, the arguments are reversed automatically when you use the default UI, so in a sense it's expected behaviour.

  3. Derek Perkins
    Member
    Posted 3 years ago #

    Thanks for the response.

    On the second issue, why don't you just pull in any connected posts, rather than restricting it to one direction? I know that I have connected posts now in my database that aren't showing up.

  4. Derek Perkins
    Member
    Posted 3 years ago #

    Another issue that I have noticed is trying to relate a post type to itself.

    1) When I relate a post type to itself, the p2p UI shows up in every edit screen.

    2) When I use query_posts with the 'connected' parameter on the same post type, the query always returns itself with the results.

  5. scribu
    Member
    Plugin Author

    Posted 3 years ago #

    What do you mean by "returns itself" ?

  6. Derek Perkins
    Member
    Posted 3 years ago #

    For example, if I have custom post type 'shoe'. I connect shoe A to Shoes B and C. When I query for shoes related to A, it returns A, B and C, instead of just B and C.

  7. scribu
    Member
    Plugin Author

    Posted 3 years ago #

    Ok, this is now fixed in the development version. Thanks for reporting.

    On the second issue, why don't you just pull in any connected posts, rather than restricting it to one direction? I know that I have connected posts now in my database that aren't showing up.

    I did this. Suppose you query 'connected' => 'A'.

    If there's a connection A->B and another one B->A, it will choose one or the other, to avoid returning B twice.

    If you happen to have different data attached to each of those connections, this might cause problems.

  8. Derek Perkins
    Member
    Posted 3 years ago #

    I think that it should return the same post twice, with the different p2pmeta information attached to each post. If the user doesn't want multiple copies of a post returned, they should either remove one of the connections or filter on the p2pmeta to only return one.

  9. scribu
    Member
    Plugin Author

    Posted 3 years ago #

    I guess you're right. Forcing an arbitrary resolution for duplicates isn't a good idea. Updated dev version.

  10. gasparking
    Member
    Posted 3 years ago #

    Hi Scribu,

    In the p2p meta box, i had a problem trying to link to a post which has only two letters in his title.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic