Skip to content

Allow plugins to inject additional template-specific open graph tags#2

Merged
blobaugh merged 2 commits into
Automattic:masterfrom
xwp:more-og-filters
Jan 15, 2014
Merged

Allow plugins to inject additional template-specific open graph tags#2
blobaugh merged 2 commits into
Automattic:masterfrom
xwp:more-og-filters

Conversation

@westonruter

Copy link
Copy Markdown
Contributor

Currently it is not possible to use Jetpack to add og tags for archive templates. This makes it possible to add og tags for them and other templates.

@blobaugh

blobaugh commented Jan 6, 2014

Copy link
Copy Markdown
Contributor

Pinging @justinshreve

@ghost ghost assigned blobaugh Jan 15, 2014
@blobaugh

Copy link
Copy Markdown
Contributor

Added to 2.8 milestone. I will test this this week

@westonruter

Copy link
Copy Markdown
Contributor Author

Here's some sample code to utilize one of these new filters to add Open Graph meta tags to a category template:

add_filter( 'jetpack_open_graph_base_tags', function ( $meta ) {
    if ( is_category() ) {
        $category = get_queried_object();
        $meta['og:title'] = $category->name;
        $meta['og:url'] = get_category_link( $category->term_id );
        if ( ! empty( $category->description ) ) {
            $meta['og:description'] = $category->description;
        }
    }
    return $meta;
} );
blobaugh added a commit that referenced this pull request Jan 15, 2014
Allow plugins to inject additional template-specific open graph tags
@blobaugh blobaugh merged commit 9db85ff into Automattic:master Jan 15, 2014
blobaugh pushed a commit that referenced this pull request Mar 13, 2014
…ific open graph tags.

Allows plugins to inject template specific code on pages other than the default pages that Open Graph is available on.
See #2

Merges r89169-wpcom.
samhotchkiss added a commit that referenced this pull request Jan 16, 2015
samhotchkiss added a commit that referenced this pull request Jan 22, 2015
samhotchkiss referenced this pull request Feb 2, 2015
Clear rows for Related Posts: Fixes #1091 and #1337
jeherve referenced this pull request in jeherve/jetpack Jul 20, 2016
Dailymotion shortcode: fix failing test.
stevenlinx pushed a commit to stevenlinx/jetpack that referenced this pull request Apr 23, 2018
kangzj added a commit that referenced this pull request May 15, 2026
…-191) (#48848)

* Search: accept canonical `search_experience` on plan/activate (SEARCH-191)

Adds the canonical `search_experience` parameter to `POST /jetpack/v4/search/plan/activate`. When set, the activate path routes through `Module_Control::update_experience()` instead of toggling the legacy `enable_instant_search` boolean. This lets WPCOM change the default experience without a Jetpack code change.

The legacy `enable_search` / `enable_instant_search` parameters keep working as a fallback for older callers.

* Address review: validate search_experience, unconditional activate, gate auto_config

- Reject non-string and `off` search_experience values up front with a 400 `invalid_experience` before any side effect (Copilot #1, #2).
- Pull `Module_Control::activate()` out of the legacy branch so it runs for both canonical and legacy callers (per Jasper's inline review). The `enable_search: false` legacy flag had no real-world caller and is dropped.
- Gate `auto_config_search` on the resulting `is_instant_search_enabled()` state so Overlay sidebar widgets aren't injected for Inline/Embedded callers (Copilot #4).
- Strengthen the invalid-experience test to assert 400 + `invalid_experience` code, and add coverage for the `off` and non-string rejection paths (Copilot #3).

* Address review: lift module activation above the search_experience block

Restores the `enable_search` opt-out flag (defaults to true) and runs `Module_Control::activate()` once at the top, before the experience-handling branch. This makes activation the explicit precondition of `/plan/activate` rather than a side effect of which payload variant the caller sent, and collapses the previously-split validation and application of `search_experience` into a single block.

* Restore original comment on enable_search gate

* Run enable_instant_search outside the search_experience branch (best-effort)

* Address review: gate legacy enable_instant_search on search_experience === null

claude[bot] re-review flagged that the previous commit (4c7cd61) made the legacy `enable_instant_search` block run after the canonical `search_experience` path, overriding any non-overlay experience (e.g. a caller sending `search_experience: 'embedded'` would end up in the overlay state). Gating the legacy block on `search_experience === null` keeps the two paths mutually exclusive without going back to an elseif.

Confirmed by re-running test_activate_plan_admin_with_search_experience — it failed against 4c7cd61 and passes with this fix.
arthur791004 added a commit that referenced this pull request May 26, 2026
Codex P1 — Restrict downgrades to MODE_ACTIVATION. Update mode's
post-update healthcheck must rollback on captured fatals; silently
downgrading sibling-load / signature-allowlist matches in update mode
would leave the site running broken files with no recovery path.

Codex P2 + self review #1 — Track candidate-load milestone in
probe-endpoint. pre-require / in-require:$plugin / required. Shutdown
handler attributes ok-shutdown during a require as throwable (real WP
activation would abort the same way), and pre-require state as
error (probe never observed the candidate, learned nothing).

Codex P3 — Drop the preserve-on-inconclusive branch in
update-healthcheck. Snapshot transients are already consumed by then;
keeping the backup directory just orphans it under temp until the
stale sweep. After P1 there are no captured-fatal downgrades in
update mode, so non-fatal here genuinely means no rollback needed.

Self review #2 — Plugin-scoped signature allowlist requires explicit
plugin attribution on the verdict. Whole-batch fallback could match
an unrelated sibling's fatal under another plugin's label.

Self review #4 — Sibling-load throwable arm restricted to PHP engine
error classes via is_php_engine_error_class. A hand-thrown
RuntimeException with class-not-found-shaped wording stays blocking.

Self review #5 — is_anomalous_allow includes ok-shutdown so the
observability backstop covers the degraded-probe case.

Self review #6 — Log Signature allowlist rejected when an entry has
no narrowing criteria, so misconfigured allowlists are visible.

Self review #7 — blog_bucket = abs($x % 100) so the result is always
non-negative even on 32-bit PHP (abs(crc32) overflows for PHP_INT_MIN).

Self review #8 — path_inside_candidate / message_references_candidate_path
normalize WP_PLUGIN_DIR with untrailingslashit so a trailing-slash
plugins root doesn't bypass the flat-file-plugin skip.

70/70 PHPUnit pass, PHPCS clean on touched files.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Feature] Publicize Now Jetpack Social, auto-sharing [Feature] Sharing Post sharing, sharing buttons

2 participants