The Greyd Global Content plugin integrates deeply with WordPress through a series of filter hooks. Filters allow you to intercept data, change it and pass it back to the plugin at strategic points in the workflow. By hooking into these filters you can customise how the plugin retrieves global posts, builds global IDs, manages distribution, handles search queries, processes email notifications and enforces update rules. This reference document explains each available filter, detailing its purpose, the parameters it accepts, the value it should return and the original source code. At the end of the document you will find practical examples that demonstrate how third‑party developers can extend the plugin’s behaviour.
For example usage of the filters, see the Global Content Filter Snippets documentation.
Core Helper Filters
greyd_get_global_post
Use this filter to modify the global post object before it is returned. When the plugin resolves a global ID and fetches the corresponding post, it applies this filter so that you can adjust the post data, add additional properties or perform other processing before the post is returned to the caller.
Parameters:
The callback receives two arguments:
WP_Post|null $post– the global post object ornullif not found.string $gid– the global ID used to look up the post.
Returns:
A WP_Post object or null. The plugin uses the returned value as the final global post.
Source:
/**
* Filter to modify the global post object before returning.
*
* This filter allows developers to customize the global post object
* that is retrieved by GID, enabling modifications to post data,
* structure, or additional processing before the post is returned.
*
* @filter greyd_get_global_post
*
* @param WP_Post|null $post The global post object or null if not found.
* @param string $gid The global ID of the post.
*
* @return WP_Post|null The modified global post object or null.
*/
return apply_filters( 'greyd_get_global_post', $post ?? null, $gid );greyd_get_gid
This filter lets you modify the global ID retrieved from a post. You can use it to change the format of the ID or inject additional processing when the plugin calls GC_Helper::get_gid().
Parameters:
string|bool $gid– the global ID orfalseif none is found.WP_Post|string $post– the post object or ID used to derive the GID.
Returns:
A string for a valid global ID or false if no ID is available. The plugin will use the returned value as the GID for subsequent operations.
Source:
return apply_filters(
'greyd_get_gid',
self::get_gc_meta( $post, 'gc_post_id' ),
$post
);greyd_explode_gid_blog_id
When the plugin explodes a global ID into its components it uses this filter to modify the blog ID part. You can adjust the blog ID or transform it based on your own rules.
Parameters:
string|null $blog_id– the blog ID extracted from the GID.
Returns:
A string or null representing the modified blog ID.
Source:
/**
* Filter to modify the blog ID component of the exploded GID.
*
* @filter greyd_explode_gid_blog_id
*
* @param string|null $blog_id The blog ID component of the GID.
*
* @return string|null The modified blog ID component.
*/
$exploded[0] = apply_filters( 'greyd_explode_gid_blog_id', $exploded[0] );greyd_explode_gid_post_id
Use this filter to modify the post ID part of an exploded global ID. It is called when splitting a GID into its components.
Parameters:
string|null $post_id– the post ID extracted from the GID.
Returns:
A string or null representing the modified post ID.
Source:
/**
* Filter to modify the post ID component of the exploded GID.
*
* @filter greyd_explode_gid_post_id
*
* @param string|null $post_id The post ID component of the GID.
*
* @return string|null The modified post ID component.
*/
$exploded[1] = apply_filters( 'greyd_explode_gid_post_id', $exploded[1] );greyd_explode_gid_site_url
This filter modifies the site URL component of an exploded global ID. Use it when you need to normalise or translate the site part of the ID.
Parameters:
string|null $site_url– the site URL extracted from the GID.
Returns:
A string or null representing the modified site URL.
Source:
/**
* Filter to modify the site URL component of the exploded GID.
*
* @filter greyd_explode_gid_site_url
*
* @param string|null $site_url The site URL component of the GID.
*
* @return string|null The modified site URL component.
*/
$exploded[2] = apply_filters( 'greyd_explode_gid_site_url', $exploded[2] );greyd_explode_gid
After individual components of a global ID have been filtered, the plugin calls this filter to modify the entire array. You can use it to reorder the values or add additional context.
Parameters:
array $exploded– an array containing[ blog_id, post_id, site_url ]after component filters.
Returns:
An array representing the modified components. Ensure that you preserve the order of values if the plugin relies on specific positions.
Source:
/**
* Filter to modify the complete exploded GID array.
*
* This filter allows developers to customize the complete array
* of exploded GID components after individual component filtering.
*
* @filter greyd_explode_gid
*
* @param array $exploded Array containing [blog_id, post_id, site_url].
*
* @return array The modified exploded GID array.
*/
return apply_filters( 'greyd_explode_gid', $exploded );Listing and query filters
greyd_get_all_global_posts
This filter runs after the plugin has assembled the complete array of global posts from both the current network and remote sources. Hook into it to modify, filter or augment the list before it is returned.
Parameters:
array $all_global_posts– an array of all global posts.string|array $query– the search query or query arguments used.string $network_url– a network URL filter passed toget_all_global_posts().
Returns:
An array representing the modified list of posts.
Source:
/**
* Filter to modify the complete array of global posts before returning.
*
* This filter allows developers to customize the complete array
* of global posts retrieved from both network and remote sources, enabling
* modifications to post data, filtering, or additional processing.
*
* @filter greyd_get_all_global_posts
*
* @param array $all_global_posts Array of all global posts.
* @param string|array $query Search query or query arguments.
* @param string $network_url Network URL filter.
*
* @return array Modified array of all global posts.
*/
return apply_filters( 'greyd_get_all_global_posts', $all_global_posts, $query, $network_url );greyd_get_all_network_posts
This filter fires after the plugin has collected all global posts from the current multisite network. Use it to modify or filter the results.
Parameters:
array $all_network_posts– an array of posts from the network.string|array $query– the query arguments used.
Returns:
An array representing the modified list of network posts.
Source:
/**
* Filter to modify the array of network posts before returning.
*
* This filter allows developers to customize the array of global
* posts retrieved from the current multisite network, enabling
* modifications to post data, filtering, or additional processing.
*
* @filter greyd_get_all_network_posts
*
* @param array $all_network_posts Array of all network posts.
* @param string|array $query Search query or query arguments.
*
* @return array Modified array of all network posts.
*/
return apply_filters( 'greyd_get_all_network_posts', $all_network_posts, $query );greyd_get_blog_global_posts
Fires when the plugin retrieves global posts for a specific blog. Your callback can filter or augment the returned array.
Parameters:
array $posts– the posts retrieved for the blog.int $blog_id– the blog ID.string $filter_status– the filter status used ('root','linked'or empty).string|array $query– the query arguments used.
Returns:
An array representing the modified list of posts for the blog.
Source:
/**
* Filter to modify the array of blog global posts before returning.
*
* This filter allows developers to customize the array of global
* posts retrieved from a specific blog, enabling modifications
* to post data, filtering, or additional processing.
*
* @filter greyd_get_blog_global_posts
*
* @param array $posts Array of global posts from the blog.
* @param int $blog_id The blog ID.
* @param string $filter_status The filter status used.
* @param string|array $query Search query or query arguments.
*
* @return array Modified array of blog global posts.
*/
return apply_filters( 'greyd_get_blog_global_posts', $posts, $blog_id, $filter_status, $query );greyd_get_local_post_by_gid
This filter runs after the plugin attempts to retrieve a local post by its global ID. You can modify the returned post or return a fallback post.
Parameters:
WP_Post|bool $local_post– the local post object orfalseif not found.string $gid– the global ID used.string $post_type– the post type filter applied.
Returns:
A WP_Post object or false. The plugin will use this as the result of get_local_post_by_gid().
Source:
/**
* Filter to modify the local post retrieved by GID before returning.
*
* This filter allows developers to customize the local post object
* that is retrieved by global ID, enabling modifications to post
* data, structure, or additional processing.
*
* @filter greyd_get_local_post_by_gid
*
* @param WP_Post|bool $local_post The local post object or false if not found.
* @param string $gid The global ID used for retrieval.
* @param string $post_type The post type filter used.
*
* @return WP_Post|bool The modified local post object or false.
*/
return apply_filters( 'greyd_get_local_post_by_gid', $local_post, $gid, $post_type );greyd_get_similar_global_posts
When the plugin searches for posts with similar titles or slugs it calls this filter before returning the result. Your callback can add or remove posts from the array.
Parameters:
array $found– an array of found similar posts.WP_Post $post– the reference post.
Returns:
An array of posts representing the modified result.
Source:
return apply_filters( 'greyd_get_similar_global_posts', $found, $post );greyd_get_global_permalink
This filter allows you to modify the global permalink generated for a post. It is called inside GC_Helper::get_global_permalink() and receives the new permalink, the post object and the original permalink. Return your own permalink to override the default.
Parameters:
string $permalink– the new permalink generated by the plugin.WP_Post $post– the post object.string $original– the original permalink.
Returns:
A string representing the modified permalink.
Source:
/**
* @filter greyd_get_global_permalink
*
* @param string $permalink The new permalink.
* @param WP_Post $post Post object.
* @param string $permalink The original permalink (if any)
*/
return apply_filters( 'greyd_get_global_permalink', $permalink, $post, $permalink );greyd_gc_get_posts_args
Before the plugin calls get_posts() internally it applies this filter to the query arguments. You can modify or add arguments to customise the post query.
Parameters:
array $args– the query arguments passed toget_posts().
Returns:
An array representing the modified query arguments.
Source:
/**
* Filter arguments for the get_post() function.
*
* @param array $args
*
* @return array $args
*/
$parsed_args = apply_filters( 'greyd_gc_get_posts_args', $args );greyd_gc_get_posts
After executing get_posts() the plugin calls this filter with the resulting array. Your callback can modify or filter the posts before they are returned.
Parameters:
WP_Post[] $posts– the array of retrieved posts.array $args– the query arguments that were used.
Returns:
An array of posts representing the modified result.
Source:
/**
* Filter the posts after the get_posts() function.
*
* @param WP_Post[] $posts
* @param array $args
*
* @return WP_Post[] $posts
*/
$posts = apply_filters( 'greyd_gc_get_posts', $posts, $args );greyd_globalcontent_user_can_edit_root_posts
This filter determines whether the current user can edit root posts. The default value is false for non‑privileged users. Return true to allow editing.
Parameters:
bool $can_edit– whether the user can edit root posts.
Returns:
A boolean indicating whether the current user can edit root posts.
Source:
/**
* Filter to allow editing of root posts.
*
* @param bool $can_edit
*
* @return bool
*/
$can_edit = apply_filters( 'greyd_globalcontent_user_can_edit_root_posts', $can_edit );greyd_globalcontent_user_can_edit_linked_posts
Similar to the previous filter, this one determines whether the current user can edit linked posts. Return true to allow editing.
Parameters:
bool $can_edit– whether the user can edit linked posts.
Returns:
A boolean indicating whether editing linked posts is allowed.
Source:
/**
* Filter to allow editing of linked posts.
*
* @param bool $can_edit
*
* @return bool
*/
$can_edit = apply_filters( 'greyd_globalcontent_user_can_edit_linked_posts', $can_edit );greyd_globalcontent_user_can_edit_global_posts
This filter controls whether a user can edit any global post regardless of status. You can use the second $status argument to apply conditional logic based on the post’s status.
Parameters:
bool $can_edit– whether the user can edit global posts.string $status– the status of the post being edited.
Returns:
A boolean indicating whether the user is allowed to edit the post.
Source:
/**
* Filter to allow editing of all global posts, no matter the status.
*
* @param bool $can_edit
*
* @return bool
*/
return apply_filters( 'greyd_globalcontent_user_can_edit_global_posts', $can_edit, $status );Distribution filters
greyd_prepared_posts_for_distribution
This filter fires after posts have been prepared for distribution but before they are returned. You can modify the array of Preparred_Post objects, adjust their properties or remove posts that should not be distributed.
Parameters:
Preparred_Post[] $preparred_posts– an array of prepared posts ready for distribution.int[] $post_ids– the IDs of the posts being distributed.array $export_args– arguments used for export.
Returns:
An array of Preparred_Post objects representing the modified distribution set.
Source:
/**
* Filter to modify the prepared posts for distribution before returning.
*
* This filter allows developers to customize the array of prepared posts
* that are ready for distribution, enabling modifications to post data,
* structure, or additional processing before distribution begins.
*
* @filter greyd_prepared_posts_for_distribution
*
* @param Preparred_Post[] $preparred_posts Array of prepared posts for distribution.
* @param int[] $post_ids Array of post IDs being distributed.
* @param array $export_args Export arguments and configuration.
*
* @return Preparred_Post[] Modified array of prepared posts for distribution.
*/
return apply_filters( 'greyd_prepared_posts_for_distribution', $preparred_posts, $post_ids, $export_args );Search filters
greyd_global_search_query_excluded_from_global_search
Use this filter to exclude certain queries from being processed by the plugin’s global search feature. If the callback returns true the plugin will not modify the query.
Parameters:
bool $excluded– whether this query is excluded from global search processing.WP_Query $query– theWP_Queryinstance (passed by reference).
Returns:
A boolean indicating whether the query should be excluded.
Source:
/**
* Filter to exclude specific queries from global search processing.
*
* This filter allows developers to prevent certain search queries from
* being processed by the global search functionality, enabling
* selective exclusion during the query preparation phase.
*
* @filter greyd_global_search_query_excluded_from_global_search
*
* @param bool $excluded Whether this query is excluded from global search.
* @param WP_Query $query The WP_Query instance (passed by reference).
*
* @return bool Whether to exclude the query from global search.
*/
$query_excluded_from_global_search = apply_filters( 'greyd_global_search_query_excluded_from_global_search', false, $query );greyd_global_search_exclude_from_query
Similar to the previous filter but applied during the results processing phase. Use it to exclude specific queries from having their results modified by the global search logic.
Parameters:
bool $excluded– whether to exclude the query from result modifications.WP_Query $query– theWP_Queryinstance (passed by reference).
Returns:
A boolean indicating whether the query should bypass result modifications.
Source:
/**
* Filter to exclude specific queries from global search results modification.
*
* This filter allows developers to prevent certain search queries from
* having their results modified by the global search functionality,
* enabling selective exclusion during the results processing phase.
*
* @filter greyd_global_search_exclude_from_query
*
* @param bool $excluded Whether this query is excluded from global search.
* @param WP_Query $query The WP_Query instance (passed by reference).
*
* @return bool Whether to exclude the query from global search results modification.
*/
$query_excluded_from_global_search = apply_filters( 'greyd_global_search_exclude_from_query', false, $query );Cluster review filters
greyd_reviews_mail_to
This filter lets you modify the recipient address for review notification emails. Use it to send notifications to multiple recipients or route emails to a custom address.
Parameters:
string $mail_to– the email address(es) to send the notification to.int $review_id– the ID of the review.
Returns:
A string containing one or more email addresses separated by commas.
Source:
/**
* Filter to modify the email recipient address(es) for review notifications.
*
* This filter allows developers to customize who receives review notification
* emails, enabling dynamic recipient management based on review context.
*
* @filter greyd_reviews_mail_to
*
* @param string $mail_to The email address(es) to send the notification to.
* @param int $review_id The ID of the review.
*
* @return string $mail_to The modified email recipient address(es).
*/
$mail_to = apply_filters( 'greyd_reviews_mail_to', $mail_to, $review_id );greyd_reviews_mail_content
Modify the HTML message content of review notification emails. You can insert additional information or reformat the message completely.
Parameters:
string $content['message']– the HTML body of the email message.int $review_id– the ID of the review.
Returns:
A string containing the modified HTML message.
Source:
/**
* Filter to modify the email message content for review notifications.
*
* This filter allows developers to customize the HTML content of review
* notification emails, enabling dynamic message formatting and content.
*
* @filter greyd_reviews_mail_content
*
* @param string $content['message'] The HTML content of the email message.
* @param int $review_id The ID of the review.
*
* @return string $content['message'] The modified email message content.
*/
$content['message'] = apply_filters( 'greyd_reviews_mail_content', $content['message'], $review_id );greyd_reviews_mail_subject
Use this filter to alter the subject line of review notification emails. It allows you to insert dynamic data or change the wording entirely.
Parameters:
string $content['subject']– the email subject line.int $review_id– the ID of the review.
Returns:
A string representing the modified email subject line.
Source:
/**
* Filter to modify the email subject line for review notifications.
*
* This filter allows developers to customize the subject line of review
* notification emails, enabling dynamic subject formatting.
*
* @filter greyd_reviews_mail_subject
*
* @param string $content['subject'] The email subject line.
* @param int $review_id The ID of the review.
*
* @return string $content['subject'] The modified email subject line.
*/
$content['subject'] = apply_filters( 'greyd_reviews_mail_subject', $content['subject'], $review_id );greyd_reviews_mail_headers
This filter lets you modify the headers of review notification emails. You can add CC or BCC recipients or define custom headers.
Parameters:
string|array $headers– the email headers string or array.int $review_id– the ID of the review.
Returns:
A string or array representing the modified headers.
Source:
<code>/**
* Filter to modify the email headers for review notifications.
*
* This filter allows developers to customize the email headers for review
* notification emails, enabling custom headers like CC, BCC, or custom
* email headers.
*
* @filter greyd_reviews_mail_headers
* @see <https: developer.wordpress.org="" reference="" functions="" wp_mail="">
*
* @param string|array $headers The email headers string or array.
* @param int $review_id The ID of the review.
*
* @return string|array $headers The modified email headers.
*/
$headers = apply_filters( 'greyd_reviews_mail_headers', $headers, $review_id );</https:></code>Content management filters
gc_allow_update_of_linked_post
This filter controls whether linked posts can be updated locally. Returning false prevents updates to linked posts, preserving content integrity across networks.
Parameters:
bool $allow_update_of_linked_post– whether updates are allowed.int $post_id– the ID of the post being updated.WP_Post $post– the post object after the update.WP_Post $post_before– the post object before the update.
Returns:
A boolean indicating whether the update should proceed.
Source:
/**
* Filter to control whether linked posts can be updated locally.
*
* This filter allows developers to control whether posts that are linked
* to global content can be updated locally. When set to false, the plugin
* prevents updates to linked posts to maintain content integrity across
* the global content system.
*
* @filter gc_allow_update_of_linked_post
*
* @param bool $allow_update_of_linked_post Whether to allow updating linked posts.
* @param int $post_id The post ID being updated.
* @param WP_Post $post The current post object.
* @param WP_Post $post_before The post object before the update.
*
* @return bool Whether to allow updating linked posts.
*/
$allow_update_of_linked_post = apply_filters( 'gc_allow_update_of_linked_post', false, $post_id, $post, $post_before );filter_gid_for_conflict_action
When importing posts the plugin checks for conflicts using the global ID. This filter lets you modify the GID used for conflict resolution. It is useful for custom GID logic or special cases during import.
Parameters:
string $gid– the global ID for the post.int $post_id– the post ID.object $post– the post object.
Returns:
A string representing the modified GID.
Source:
/**
* Filter to modify the GID (Global ID) used for conflict resolution during import.
*
* This filter allows developers to customize how the GID is generated or retrieved
* when checking for conflicts between global posts during import operations.
* It's useful for implementing custom GID logic or handling special cases
* during import.
*
* @filter filter_gid_for_conflict_action
*
* @param string $gid The GID (Global ID) for the post.
* @param int $post_id The post ID.
* @param object $post The post object.
*
* @return string $gid The modified GID for conflict resolution.
*/
$gid = apply_filters( 'filter_gid_for_conflict_action', GC_Helper::get_gid( $post ), $post->ID, (object) $post );