Code Snippets
Category Code Snippets
Jetpack: remove External Media from the block editor
PHP/** * Remove Jetpack's External Media feature. */ add_action( 'enqueue_block_editor_assets', function () { $disable_external_media = <<<JS document.addEventListener( 'DOMContentLoaded', function() {…
September 13, 2022
Jetpack Related Posts
Set a default image: Exclude posts without images: Sources:
September 13, 2022
Jetpack: Add UTM Tracking to Sharing Buttons
PHP/** * Overwrite the links used in Jetpack's Sharing module. * * @see https://wordpress.org/support/topic/how-to-use-utm-codes-with-jetpack-sharing * * @param string $url *…
September 13, 2022
Jetpack Subscriptions
PHP/** * Redirect all successful subscription submissions to a 'thank-you' page. */ function hlabs_custom_sub_redirect_page( $result ) { if ( 'success'…
September 13, 2022
Jetpack
Enable Development Mode: Choose modules to be activated by default: Deactivate All Jetpack Modules by Default Completely Hide Modules from the Jetpack Page Turn off Jetpack publish by default:
September 13, 2022
Jetpack Photon Snippets
Determine if Jetpack is installed and can generate photon URLs: Determine whether photon is an active Jetpack module: Example how to apply photon to any image you wish to load via custom theme: Example with argument: Set custom photon arguments for all photon urls: Set header Image to use photon: Supported query arguments: Parameter Description […]
September 13, 2022