coresocial_page_context

Developer Knowledge Level

This content is intended for WordPress developers, and it may require coding knowledge of WordPress, PHP, and JavaScript. Code examples provided here may contain errors or needs some additional coding. Make sure to test the code before using it on a live website!

PHP
Definition
apply_filters( "coresocial_page_context", $context );
coreSocial 4.0 — core/base/Method.php:97
Arguments
Name
Type
Description
$context
array
Page context with item, item_id, title, url, and image keys.
Returns
array — Complete context array.

Runs when a sharing method resolves its page context. The underlying context is cached for the request, but the filter runs when context() returns it.

Preserve the complete array. item is post, term, or custom; item_id is the WordPress ID or 0 for custom URLs. image is the featured-image URL or an empty string.

This controls the shared page context, not only its appearance. AJAX validation still requires valid signatures, appropriate action/network/module combinations, and publicly viewable post or term targets.

Example

add_filter( 'coresocial_page_context', function ( $context ) {
    if ( $context['item'] === 'custom' ) {
        $context['title'] = wp_strip_all_tags( $context['title'] );
    }
    return $context;
} );
Rate this reference
0
0
2

You are not allowed to rate this post.

Leave a Comment

0
0
0
0
0
0
0
0
0