The Greyd Global Content plugin supports constants that allow you to change its behavior without editing the plugin code. These constants can be defined in wp-config.php
or a theme’s functions.php
file and must be set before the plugin loads. They are used to control SEO-related URL handling and optimize performance during content distribution.
USE_CANONICAL_URL_AS_PERMALINK
This constant defines whether the plugin should use canonical URLs instead of standard permalinks for global posts.
Default value: false
(not defined)
Accepted values: true
or false
When set to true
, the plugin prioritizes canonical URLs over the default permalinks. This helps ensure consistent URL structures across multiple sites, improves SEO, and can reduce duplicate content issues. The feature integrates with SEO plugins such as Yoast SEO and Rank Math.
Example usage:
// In wp-config.php
define( 'USE_CANONICAL_URL_AS_PERMALINK', true );
// Or in theme functions.php
if ( ! defined( 'USE_CANONICAL_URL_AS_PERMALINK' ) ) {
define( 'USE_CANONICAL_URL_AS_PERMALINK', true );
}
Implementation details:
- Influences the
get_global_permalink()
function. - Modifies permalink generation for linked posts.
- Works with external canonical URL logic from SEO plugins.
GC_DISTRIBUTOR_CHUNK_SIZE
This constant defines the number of posts processed in each batch during distribution.
Default value: 25
(if not defined)
Accepted values: Any positive integer
The value determines how many posts are processed simultaneously during content distribution. Adjusting it can help balance performance and memory usage, especially during large-scale synchronizations.
Example usage:
// In wp-config.php
define( 'GC_DISTRIBUTOR_CHUNK_SIZE', 50 );
// Or in theme functions.php
if ( ! defined( 'GC_DISTRIBUTOR_CHUNK_SIZE' ) ) {
define( 'GC_DISTRIBUTOR_CHUNK_SIZE', 50 );
}
Recommended values:
- Low-resource servers:
10–25
- Standard servers:
25–50
- High-performance servers:
50–100
- Enterprise servers:
100+
Implementation details:
- Affects the ActionScheduler queue processing.
- Controls batch size in distribution operations.
- Impacts memory usage during synchronization.
Best Practices for Defining Constants
Placement of Constants
Define constants in wp-config.php
for global site-wide configuration. Alternatively, place them in functions.php
if the configuration should be theme-specific.
Definition Order
Always define constants before the plugin loads to ensure they take effect.
// In wp-config.php
define( 'USE_CANONICAL_URL_AS_PERMALINK', true );
define( 'GC_DISTRIBUTOR_CHUNK_SIZE', 50 );
Conditional Definition
Use conditional definitions to avoid redefinition conflicts.
if ( ! defined( 'USE_CANONICAL_URL_AS_PERMALINK' ) ) {
define( 'USE_CANONICAL_URL_AS_PERMALINK', true );
}