WP Manifestindependent plugin directory
manifest / developer / posts-to-posts-exclude

Posts 2 Posts - Exclude Parents / Children

Posts to Posts - Exclude Parents / Children

★ 0stars

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/yaronguez/posts-to-posts-exclude/archive/refs/heads/master.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

Posts to Posts - Exclude Parents / Children

Allow WordPress developers using the Posts 2 Posts plugin to exclude posts that are parents or children of a specific link type when using WP Query.

Description

Upon activating this plugin, just add a exclude_children or exclude_parents argument to WP Query constructor and specify the name of the link type:

// Exclude any posts that are children of type [link_name]
$query = new WP_Query(array(
    'exclude_children' => '[link_name]',
));

// Exclude any posts that are parents of type [link_name]
$query = new WP_Query(array(
    'exclude_parents' => '[link_name]',
));

[link_name] is whatever you defined your Posts to Posts relationship to be. Done!

Changelog

1.0

  • Initial version