Skip to content

Instantly share code, notes, and snippets.

@cameronbaney
cameronbaney / gist:4568453
Last active December 11, 2015 07:48
This is for getting relationships in WordPress
<?php
// Variable for post ID
$pID = '"' . $post->ID . '"';
// Query the relationship
$relpa = new WP_Query(array('post_type'=>'page','posts_per_page'=>'-1','post_parent'=>'6',
'meta_query'=>array(
array(
'key' => 'rel_attorney', // This is the custom field's name
'value' => "$pID", // This is the post ID of the current page you're on