How to embed Pinterest board in WordPress

To embed Pinterest board into your WordPress post or page:
  1. Open your Pinterest board. Click three dots in the right top corner and select Make a widget from the drop down menu.Pinterest - Make a widget
  2. Copy all code from the textarea. Place cursor into the text area, press keyboard shortcut CTRL + A to highlight the code.Pinterest - Make a widget
  3. In WordPress post or page switch from Visual editor to Text and paste the code CTRL + V.Paste Pinterest code into WordPress post
  4. Now you can publish your post and the Pinterest board should load. However, you are supposed to call Pinterest JavaScript code “//” only once per page. If you can edit your WordPress theme, you can enqueue script in functions.php.
  5. Delete the last two lines of Pinterest code from your post:
    <!-- Please call pinit.js only once per page -->
    <script src="//" async="" defer="defer" type="text/javascript"></script>
  6. Open functions.php in your favourite text editor and find a function which enqueues scripts for your theme. Add wp_enqueue_script( ‘my-pinterest’, ‘//’, array(), false, true ); inside the function.
    function theme_name_scripts() {
        wp_enqueue_script( 'my-pinterest', '//', array(), false, true );
    add_action( 'wp_enqueue_scripts', 'theme_name_scripts' );
  7. Into functions.php add the following function:
    function add_defer_attribute($tag) {
        $scripts_to_defer = array('//');
        foreach( $scripts_to_defer as $defer_script ) {
            if ( true == strpos($tag, $defer_script) ) {
                return str_replace( ' src', ' defer="defer" src', $tag );
        return $tag;
    add_filter('script_loader_tag', 'add_defer_attribute', 10, 2);