URGENT ISSUE WITH WORDPRESS!!!!!

BenneFyr

Registered Member
Joined
Jun 18, 2018
Messages
76
Reaction score
23
URGENT PROBLEM!!!!

I deleted the Jetpack WordPress plugin on my website. And now EVERY SINGLE Pinterest embed is broken (literally just shows a plain URL now).

Is there a way to automatically convert these URL's into the WordPress Gutenberg Pinterest block? This is HORRIBLE!

Please tell me you can help me!!! :weep:

Thank you very much in advance!!!
 
Sorry for being captain obvious but cant you activate Jetpack again? The problem is probably that Jetpack embeds its own code around the URL which other plugins and Gutenberg cant handle/read. I think a simple custom plugin is a solution.
 
Sorry for being captain obvious but cant you activate Jetpack again? The problem is probably that Jetpack embeds its own code around the URL which other plugins and Gutenberg cant handle/read. I think a simple custom plugin is a solution.
Yes, I could do that. But the problem is that Jetpack is bloating my website and slowing it down, so I'd rather not do that. I'm hoping there is a way to MASS change this code instead of manually changing them?
 
So you can try this but backup your site before you run it!
This is a plugin so you can create a php file and put it in your plugin folder.


Code:
<?php
/**
 * Plugin Name: Pinterest Block Conversion for Jetpack
 * Description: Converts Jetpack Pinterest blocks to Gutenberg blocks.
 * Version: 1.0
 * Author: tearzkiller
 * Author URI: https://doesntexist.com
 */

function pinterest_block_conversion_jetpack_register_block() {
  if ( function_exists( 'register_block_type' ) ) {
    // Register the block type
    register_block_type( 'pinterest-block-conversion-jetpack/converted-block', array(
      'render_callback' => 'pinterest_block_conversion_jetpack_render_block',
    ) );
  }
}
add_action( 'init', 'pinterest_block_conversion_jetpack_register_block' );

function pinterest_block_conversion_jetpack_render_block( $attributes ) {
  $output = '';

  // Get the Pinterest URL and board ID from the block attributes
  $pinterest_url = isset( $attributes['pinterestUrl'] ) ? $attributes['pinterestUrl'] : '';
  $board_id = isset( $attributes['boardId'] ) ? $attributes['boardId'] : '';

  // Use the Pinterest URL and board ID to generate the Pinterest block HTML
  $output .= '<a data-pin-do="embedBoard" data-pin-board-width="400" data-pin-scale-height="240" data-pin-scale-width="80" href="' . esc_url( $pinterest_url ) . '"></a>';

  return $output;
}
 
So you can try this but backup your site before you run it!
This is a plugin so you can create a php file and put it in your plugin folder.


Code:
<?php
/**
 * Plugin Name: Pinterest Block Conversion for Jetpack
 * Description: Converts Jetpack Pinterest blocks to Gutenberg blocks.
 * Version: 1.0
 * Author: tearzkiller
 * Author URI: https://doesntexist.com
 */

function pinterest_block_conversion_jetpack_register_block() {
  if ( function_exists( 'register_block_type' ) ) {
    // Register the block type
    register_block_type( 'pinterest-block-conversion-jetpack/converted-block', array(
      'render_callback' => 'pinterest_block_conversion_jetpack_render_block',
    ) );
  }
}
add_action( 'init', 'pinterest_block_conversion_jetpack_register_block' );

function pinterest_block_conversion_jetpack_render_block( $attributes ) {
  $output = '';

  // Get the Pinterest URL and board ID from the block attributes
  $pinterest_url = isset( $attributes['pinterestUrl'] ) ? $attributes['pinterestUrl'] : '';
  $board_id = isset( $attributes['boardId'] ) ? $attributes['boardId'] : '';

  // Use the Pinterest URL and board ID to generate the Pinterest block HTML
  $output .= '<a data-pin-do="embedBoard" data-pin-board-width="400" data-pin-scale-height="240" data-pin-scale-width="80" href="' . esc_url( $pinterest_url ) . '"></a>';

  return $output;
}
I must admit, I'm not very tech savvy. Is this going to automatically convert all of the Pinterest embeds using the Jetpack code to the Gutenberg Pinterest embed block?

I really appreciate your help!
 
I understand, the safest method is to do it manually. Running code from a stranger is always risky and for example, if you forget to back up your database it could be harmful.

Do you use a caching plugin? Maybe you can keep jetpack if you also run a caching plugin.
 
some of the plugins may have collided or try to reactivate the jetpacks it would be fine
 
Back
Top