• Hey Guys, Very cool plugin, juts one question,

    I need some direction with regards to your plugin.

    How, Would i programmatically create a connection between posts or post types (obviously with some parameters so it knows which posts to assign and “join”)

    I’ve checked on the documentation and there is some direction, But i really don’t know how to apply it. Here

    So basically, when you create a post & its assigned to certain taxonomy, The post will automatically be be grouped with the connection type (which you define in functions file)

    Is this possible?

    Bests
    Lee

    https://www.ads-software.com/plugins/posts-to-posts/

Viewing 1 replies (of 1 total)
  • For connecting posts programmatically you just need to gather both post ids:

    p2p_type( 'dogs_to_cats' )->connect( $first_post_id, $second_post_id, array('date' => current_time('mysql')) );

    For adding a taxonomy term at the same time:

    wp_set_post_terms( $first_post_id, 'Term', 'your_taxonomy', true );

Viewing 1 replies (of 1 total)
  • The topic ‘Programtically create connection’ is closed to new replies.