Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cloning Doesnt Work with Yoast SEO plugin activated #854

Closed
joeporterme opened this issue May 5, 2016 · 14 comments
Closed

Cloning Doesnt Work with Yoast SEO plugin activated #854

joeporterme opened this issue May 5, 2016 · 14 comments
Assignees

Comments

@joeporterme
Copy link

joeporterme commented May 5, 2016

Think there is a javascript issue. Just tested... I had Yoast SEO plugin installed.. created my cloning fields and cloning didnt work. Deactivated Yoast and boom cloning was working. Also the drag and drop image fields

@rilwis rilwis changed the title Cloning Doesnt Work with Yoast SEO plugin activated Cloning Doesnt Work with Yoast SEO plugin activated May 9, 2016
@rilwis
Copy link
Member

rilwis commented May 9, 2016

@funkedgeek Please look at this issue

@joeporterme
Copy link
Author

FYI - Yoast 3.2.5 came out... tested and still an issue.

@funkatron82
Copy link
Contributor

Not able to replicate this bug. cloning is working for me. Are you getting any errors in the JavaScript console?

@joeporterme
Copy link
Author

Here is a screencast of hit happening with Console Open.

https://www.dropbox.com/s/1fvypgorgw0zofv/yoastmetabox.mov?dl=0

error seems to be coming in the wp-seo-post-scraper-324.min.js

Just letting you know, im running a child theme off Wordpress 2016 theme.

@funkatron82
Copy link
Contributor

Looks like a bug that is preventing other JavaScript code from running. I'm still not able to replicate it, though

@joeporterme
Copy link
Author

Doing a google search on the error looks like someone else has an issue with it and metabox.io and posted a comment over at yoast: Yoast/wordpress-seo#4161

@rilwis
Copy link
Member

rilwis commented May 16, 2016

I'm not able to replicate the bug, neither. @joeporterme: can you please give us more details to track this:

  • Code to register post type
  • Code to register meta boxes
  • Which user role are you using

@joeporterme
Copy link
Author

joeporterme commented May 16, 2016

<?php
/**
* Plugin Name: Life Network Clients
* Plugin URI: https://greanews.life
* Description: Life Network Clients Management - Manages Advertising and Partner Profiles
* Version: 1.0
* Author: GreatNews.life
* Author URI: greatnews.life
* License: NONE
*/

/**** INCLUDE FILES *******/
include( plugin_dir_path( __FILE__ ) . 'inc/meta-boxes.php');

/**** REMOVE PLUGINS FROM ACCESSING THIS POST TYPE *****/

function prefix_remove_meta_box() {
    remove_meta_box( 'wpseo_meta', 'gnl_clients', 'normal' ); // change custom-post-type into the name of your custom post type
}
  add_action( 'add_meta_boxes', 'prefix_remove_meta_box', 100000 );

// Get the Sites Options On the Network

function gnl_clients_get_sites_info() {
    $sitearray[] = array();
    $args = array(
        'network_id' => null,
        'public'     => null,
        'archived'   => null,
        'mature'     => null,
        'spam'       => null,
        'deleted'    => null,
        'limit'      => 100,
        'offset'     => 0,
    );
    $blogarray = wp_get_sites( $args );

    foreach ($blogarray as $site) :

        // dont include master site in array
        if ($site['blog_id'] != 1) :

            $id = $site['blog_id'];
            $sitesettings[$id] = get_blog_option( $id, 'site_info_option_name');

        endif;

    endforeach;

    return $sitesettings;

}


/*** Setup the Post type and Menu ****/
if ( ! function_exists('gnl_client_function') ) {

// Register Custom Post Type
function gnl_client_function() {

    $labels = array(
        'name'                  => _x( 'Clients', 'Post Type General Name', 'text_domain' ),
        'singular_name'         => _x( 'Client', 'Post Type Singular Name', 'text_domain' ),
        'menu_name'             => __( 'Partners', 'text_domain' ),
        'name_admin_bar'        => __( 'Partners', 'text_domain' ),
        'archives'              => __( 'Partners', 'text_domain' ),
        'parent_item_colon'     => __( 'Parent Partner:', 'text_domain' ),
        'all_items'             => __( 'All Partners', 'text_domain' ),
        'add_new_item'          => __( 'Add New Partner', 'text_domain' ),
        'add_new'               => __( 'Add New', 'text_domain' ),
        'new_item'              => __( 'New Partner', 'text_domain' ),
        'edit_item'             => __( 'Edit Partner', 'text_domain' ),
        'update_item'           => __( 'Update Partner', 'text_domain' ),
        'view_item'             => __( 'View Partner', 'text_domain' ),
        'search_items'          => __( 'Search Partners', 'text_domain' ),
        'not_found'             => __( 'Not found', 'text_domain' ),
        'not_found_in_trash'    => __( 'Not found in Trash', 'text_domain' ),
        'featured_image'        => __( 'Partner Logo (PNG)', 'text_domain' ),
        'set_featured_image'    => __( 'Set Partner Logo', 'text_domain' ),
        'remove_featured_image' => __( 'Remove Partner Logo', 'text_domain' ),
        'use_featured_image'    => __( 'Use as Partner Logo', 'text_domain' ),
        'insert_into_item'      => __( 'Insert into Partner', 'text_domain' ),
        'uploaded_to_this_item' => __( 'Uploaded to this Partner', 'text_domain' ),
        'items_list'            => __( 'Partners list', 'text_domain' ),
        'items_list_navigation' => __( 'Partners list navigation', 'text_domain' ),
        'filter_items_list'     => __( 'Filter Partners list', 'text_domain' ),
    );
    $rewrite = array(
        'slug'                  => 'partner',
        'with_front'            => true,
        'pages'                 => false,
        'feeds'                 => true,
    );
    $capabilities = array(
        'edit_post'             => 'edit_partner',
        'read_post'             => 'read_partner',
        'delete_post'           => 'delete_partner',
        'edit_posts'            => 'edit_partners',
        'edit_others_posts'     => 'edit_others_partners',
        'publish_posts'         => 'publish_partners',
        'read_private_posts'    => 'read_private_partners',
    );
    $args = array(
        'label'                 => __( 'Partners', 'text_domain' ),
        'description'           => __( 'Partners Management', 'text_domain' ),
        'labels'                => $labels,
        'supports'              => array( 'title', 'thumbnail', 'revisions', ),
        'hierarchical'          => true,
        'public'                => true,
        'show_ui'               => true,
        'show_in_menu'          => true,
        'menu_position'         => 5,
        'menu_icon'             => 'dashicons-groups',
        'show_in_admin_bar'     => true,
        'show_in_nav_menus'     => true,
        'can_export'            => true,
        'has_archive'           => false,
        'exclude_from_search'   => true,
        'publicly_queryable'    => true,
        'rewrite'               => $rewrite,
        'capabilities'          => $capabilities,
    );
    register_post_type( 'gnl_clients', $args );

}
add_action( 'init', 'gnl_client_function', 0 );

}`

`$lifesites = gnl_clients_get_sites_info();
$sites[] = array();
//setup checkbox list for sites
foreach($lifesites as $key => $site) :
    $sites[$key] = $site['site_name_0'];
endforeach;

add_filter( 'rwmb_meta_boxes', 'gnl_clients_register_meta_boxes' );
function gnl_clients_register_meta_boxes( $meta_boxes ) {
        global $sites;
    $prefix = 'gnl_clients_billing_';
        // 1st meta box
    $meta_boxes[] = array(
        'id'         => 'billing',
        'title'      => __( 'Billing Information', 'textdomain' ),
        'post_types' => array( 'gnl_clients' ),
        'context'    => 'normal',
        'priority'   => 'high',
                'validation' => array(
                        'rules'    => array(
                                "{$prefix}address" => array(
                                        'required'  => true,
                                        // More rules here
                                ),
                                "{$prefix}city" => array(
                                        'required'  => true,
                                        // More rules here
                                ),
                                "{$prefix}state" => array(
                                        'required'  => true,
                                        'maxlength' => 2,
                                        'minlength' => 2
                                        // More rules here
                                ),
                                "{$prefix}zip" => array(
                                        'required'  => true,
                                        'digits' => true,
                                        'maxlength' => 5,
                                        'minlength' => 5
                                        // More rules here
                                ),
                                // Rules for other fields
                        ),
                ),
        'fields' => array(
            array(
                'name'  => __( 'Billing Address', 'textdomain' ),
                'desc'  => '',
                'id'    => $prefix . 'address',
                'type'  => 'text',
                'std'   => '',
                'class' => 'billing-class',
                'size' => '30'

            ),
                        array(
                'name'  => __( 'Billing City', 'textdomain' ),
                'desc'  => '',
                'id'    => $prefix . 'city',
                'type'  => 'text',
                'std'   => '',
                'class' => 'billing-class',
                'size' => '30'
            ),
                        array(
                'name'  => __( 'Billing State', 'textdomain' ),
                'desc'  => '',
                'id'    => $prefix . 'state',
                'type'  => 'text',
                'std'   => '',
                'class' => 'billing-class',
                'size' => '2'
            ),
                        array(
                'name'  => __( 'Billing Zip', 'textdomain' ),
                'desc'  => '',
                'id'    => $prefix . 'zip',
                'type'  => 'text',
                'std'   => '',
                'class' => 'billing-class',
                'size' => '5'
            ),
                        array(
                                'name'  => __( 'Client Notes', 'textdomain' ),
                                'desc'  => '',
                                'id'    => $prefix . 'notes',
                                'type'  => 'textarea',
                                'std'   => '',
                                'class' => 'billing-class',
                                'rows' => '8'
                        ),
                        array(
                'name'  => __( 'Activate Partner Profile', 'textdomain' ),
                'desc'  => '',
                'id'    => $prefix . 'service_profile',
                'type'  => 'checkbox',
                'class' => 'billing-class',
            ),
                        array(
                'name'  => __( 'Activate Banner Ads', 'textdomain' ),
                'desc'  => '',
                'id'    => $prefix . 'service_banners',
                'type'  => 'checkbox',
                'class' => 'billing-class',
            ),
                        array(
                'name'  => __( 'Activate Photo Sponsors', 'textdomain' ),
                'desc'  => '',
                'id'    => $prefix . 'service_photos',
                'type'  => 'checkbox',
                'class' => 'billing-class',
            ),
                        array(
                'name'  => __( 'Activate Video Sponsors', 'textdomain' ),
                'desc'  => '',
                'id'    => $prefix . 'service_video',
                'type'  => 'checkbox',
                'class' => 'billing-class',
            ),
        )
            );
            $prefix_contacts = 'gnl_clients_contacts_';
            $meta_boxes[] = array(
            'id'         => 'contacts',
            'title'      => __( 'Client Contacts', 'textdomain' ),
            'post_types' => array( 'gnl_clients' ),
            'context'    => 'normal',
            'priority'   => 'high',
            'fields' => array(
                array(
                    'name'  => __( 'Billing Contact Name', 'textdomain' ),
                    'desc'  => '',
                    'id'    => $prefix_contacts . 'billing_name',
                    'type'  => 'text',
                    'std'   => '',
                    'class' => 'billing-class',
                    'size' => '30'
                ),
                            array(
                    'name'  => __( 'Billing Contact Email', 'textdomain' ),
                    'desc'  => '',
                    'id'    => $prefix_contacts . 'billing_email',
                    'type'  => 'text',
                    'std'   => '',
                    'class' => 'billing-class',
                    'size' => '30'
                ),
                            array(
                    'name'  => __( 'Billing Contact Phone', 'textdomain' ),
                    'desc'  => '',
                    'id'    => $prefix_contacts . 'billing_phone',
                    'type'  => 'text',
                    'std'   => '',
                    'class' => 'billing-class',
                    'size' => '30'
                ),
                            array(
                    'name'  => __( 'Content Contact Name', 'textdomain' ),
                    'desc'  => '',
                    'id'    => $prefix_contacts . 'content_name',
                    'type'  => 'text',
                    'std'   => '',
                    'class' => 'billing-class',
                    'size' => '30'
                ),
                            array(
                    'name'  => __( 'Content Contact Email', 'textdomain' ),
                    'desc'  => '',
                    'id'    => $prefix_contacts . 'content_email',
                    'type'  => 'text',
                    'std'   => '',
                    'class' => 'billing-class',
                    'size' => '30'
                ),
                            array(
                    'name'  => __( 'Content Contact Phone', 'textdomain' ),
                    'desc'  => '',
                    'id'    => $prefix_contacts . 'content_phone',
                    'type'  => 'text',
                    'std'   => '',
                    'class' => 'billing-class',
                    'size' => '30'
                ),
            )
    );
        $prefix_profile = 'gnl_clients_profile_';
        $meta_boxes[] = array(
                'id'         => 'profile',
                'title'      => __( 'Partner Profile', 'textdomain' ),
                'post_types' => array( 'gnl_clients' ),
                'context'    => 'normal',
                'priority'   => 'high',
                'fields' => array(
                        array(
                                'name'  => __( 'Published On:', 'textdomain' ),
                                'desc'  => '',
                                'id'    => $prefix_profile . 'sites',
                                'type'  => 'checkbox_list',
                                'class' => 'profile-class',
                                'options'=> $sites,
                        ),

                        array(
                                'name'  => __( 'Profile About Section', 'textdomain' ),
                                'desc'  => '',
                                'id'    => $prefix_profile . 'about',
                                'type'  => 'textarea',
                                'std'   => '',
                                'class' => 'profile-class',
                                'rows' => '8'
                        ),
                        array(
                'name'  => __( 'Profile Address', 'textdomain' ),
                'desc'  => '',
                'id'    => $prefix_profile . 'address',
                'type'  => 'text',
                'std'   => '',
                'class' => 'profile-class',
                'size' => '30'
            ),
                        array(
                'name'  => __( 'Profile City', 'textdomain' ),
                'desc'  => '',
                'id'    => $prefix_profile . 'city',
                'type'  => 'text',
                'std'   => '',
                'class' => 'profile-class',
                'size' => '30'
            ),
                        array(
                'name'  => __( 'Profile State', 'textdomain' ),
                'desc'  => '',
                'id'    => $prefix_profile . 'state',
                'type'  => 'text',
                'std'   => '',
                'class' => 'profile-class',
                'size' => '2'
            ),
                        array(
                'name'  => __( 'Profile Zip', 'textdomain' ),
                'desc'  => '',
                'id'    => $prefix_profile . 'zip',
                'type'  => 'text',
                'std'   => '',
                'class' => 'profile-class',
                'size' => '5'
            ),
                        array(
                'name'  => __( 'Profile Location Description', 'textdomain' ),
                'desc'  => 'example: "We have 15 locations through out NW Indiana"',
                'id'    => $prefix_profile . 'loc_desc',
                'type'  => 'text',
                'std'   => '',
                'class' => 'profile-class',
                'size' => '30'
            ),
                        array(
                'name'  => __( 'Facebook ID', 'textdomain' ),
                'desc'  => 'http://findmyfbid.com/',
                'id'    => $prefix_profile . 'facebook',
                'type'  => 'text',
                'std'   => '',
                'class' => 'profile-class',
                'size' => '30',
                                'clone' => true
            ),
                        array(
                'name'  => __( 'Twitter Username', 'textdomain' ),
                'desc'  => 'without @',
                'id'    => $prefix_profile . 'twitter',
                'type'  => 'text',
                'std'   => '',
                'class' => 'profile-class',
                'size' => '30',
                                'clone'=> true
            ),
                        array(
                'name'  => __( 'Instagram Username', 'textdomain' ),
                'desc'  => 'without @',
                'id'    => $prefix_profile . 'instagram',
                'type'  => 'text',
                'std'   => '',
                'class' => 'profile-class',
                'size' => '30',
                                'clone'=> true
            ),
                        array(
                'name'  => __( 'YouTube Channel ID', 'textdomain' ),
                'desc'  => 'http://johnnythetank.github.io/youtube-channel-name-converter/',
                'id'    => $prefix_profile . 'youtube',
                'type'  => 'text',
                'std'   => '',
                'class' => 'profile-class',
                'size' => '30',
                                'clone'=> true
            ),
                        array(
                'name'  => __( 'LinkedIn URLs', 'textdomain' ),
                'desc'  => 'Direct Page Urls: Example: https://www.linkedin.com/groups/3838410/profile',
                'id'    => $prefix_profile . 'linkedin',
                'type'  => 'text',
                'std'   => '',
                'class' => 'profile-class',
                'size' => '30',
                                'clone'=> true
            ),
                        array(
                'name'  => __( 'Website URL', 'textdomain' ),
                'desc'  => '',
                'id'    => $prefix_profile . 'website',
                'type'  => 'text',
                'std'   => '',
                'class' => 'profile-class',
                'size' => '30',
                                'clone'=> true
            ),
                        array(
                'name'  => __( 'Profile Menu URLS', 'textdomain' ),
                'desc'  => '',
                'id'    => $prefix_profile . 'website_urls',
                'type'  => 'text_list',
                'std'   => '',
                'class' => 'profile-class',
                'size' => '30',
                                'options' => array(
                                        'Link Title' => __( '', $prefix_profile.'link_title' ),
                                        'Link URL' => __( '', $prefix_profile.'link_url' ),
                                ),
                                'clone'=> true
            ),
                        array(
                                'name'  => __( 'Banner Image', 'textdomain' ),
                                'desc'  => '',
                                'id'    => $prefix_profile . 'banner_img',
                                'type'  => 'image_advanced',
                                'class' => 'profile-class',
                                'force_delete'     => true,
                                // Maximum image uploads
                                'max_file_uploads' => 1

                        ),
                )

        );
        $prefix_banner = 'gnl_clients_banner_ads_';
        $meta_boxes[] = array(
                'id'         => 'banner_ads',
                'title'      => __( 'Banner Ads', 'textdomain' ),
                'post_types' => array( 'gnl_clients' ),
                'context'    => 'normal',
                'priority'   => 'high',
                'fields' => array(
                        array(
                                'name'  => __( 'Premium Published On:', 'textdomain' ),
                                'desc'  => '',
                                'id'    => $prefix_banner . 'premium_sites',
                                'type'  => 'checkbox_list',
                                'class' => 'banner-class',
                                'options'=> $sites,
                        ),
                        array(
                                'name'  => __( 'Premium Image', 'textdomain' ),
                                'desc'  => '600x600 Square',
                                'id'    => $prefix_banner . 'premium_img',
                                'type'  => 'image_advanced',
                                'class' => 'banner-class',
                                'force_delete'     => true,
                                // Maximum image uploads
                                'max_file_uploads' => 1

                        ),
                        array(
                                'name'  => __( 'Premium Destination URL', 'textdomain' ),
                                'desc'  => 'Full URL',
                                'id'    => $prefix_banner . 'premium_url',
                                'type'  => 'text',
                                'class' => 'banner-class',
                                'size' => '30',

                        ),

                        array(
                                'name'  => __( 'Standard Published On:', 'textdomain' ),
                                'desc'  => '',
                                'id'    => $prefix_banner . 'premium_sites',
                                'type'  => 'checkbox_list',
                                'class' => 'banner-class',
                                'options'=> $sites,
                        ),
                        array(
                                'name'  => __( 'Standard Image', 'textdomain' ),
                                'desc'  => '600x600 Square',
                                'id'    => $prefix_banner . 'standard_img',
                                'type'  => 'image_advanced',
                                'class' => 'banner-class',
                                'force_delete'     => true,
                                // Maximum image uploads
                                'max_file_uploads' => 1

                        ),
                        array(
                                'name'  => __( 'Standard Destination URL', 'textdomain' ),
                                'desc'  => 'Full URL',
                                'id'    => $prefix_banner . 'standard_url',
                                'type'  => 'text',
                                'class' => 'banner-class',
                                'size' => '30',

                        ),

                        array(
                                'name'  => __( 'Basic Published On:', 'textdomain' ),
                                'desc'  => '',
                                'id'    => $prefix_banner . 'basic_sites',
                                'type'  => 'checkbox_list',
                                'class' => 'banner-class',
                                'options'=> $sites,
                        ),
                        array(
                                'name'  => __( 'Basic Image', 'textdomain' ),
                                'desc'  => '600x600 Square',
                                'id'    => $prefix_banner . 'basic_img',
                                'type'  => 'image_advanced',
                                'class' => 'banner-class',
                                'force_delete'     => true,
                                // Maximum image uploads
                                'max_file_uploads' => 1

                        ),
                        array(
                                'name'  => __( 'Basic Destination URL', 'textdomain' ),
                                'desc'  => 'Full URL',
                                'id'    => $prefix_banner . 'basic_url',
                                'type'  => 'text',
                                'class' => 'banner-class',
                                'size' => '30',

                        ),

                        array(
                                'name'  => __( 'Site Sponsor Published On:', 'textdomain' ),
                                'desc'  => '',
                                'id'    => $prefix_banner . 'sponsor_sites',
                                'type'  => 'checkbox_list',
                                'class' => 'banner-class',
                                'options'=> $sites,
                        ),
                        array(
                                'name'  => __( 'Site Sponsor Image', 'textdomain' ),
                                'desc'  => '1960x164 Rectangle',
                                'id'    => $prefix_banner . 'sponsor_img',
                                'type'  => 'image_advanced',
                                'class' => 'banner-class',
                                'force_delete'     => true,
                                // Maximum image uploads
                                'max_file_uploads' => 1

                        ),
                        array(
                                'name'  => __( 'Site Sponsor Destination URL', 'textdomain' ),
                                'desc'  => 'Full URL',
                                'id'    => $prefix_banner . 'sponsor_url',
                                'type'  => 'text',
                                'class' => 'banner-class',
                                'size' => '30',

                        ),
                )

        );
    return $meta_boxes;
}

@joeporterme
Copy link
Author

signed in as administrator

@rilwis
Copy link
Member

rilwis commented May 16, 2016

Awesome, let me work on it now.

@joeporterme
Copy link
Author

oh.. maybe this will help or not... but i am on a Wordpress Multisite Install ... not sure if that is something you should know

@rilwis
Copy link
Member

rilwis commented May 16, 2016

Just found the bug!

You removed the Yoast SEO meta box with this code

function prefix_remove_meta_box() {
    remove_meta_box( 'wpseo_meta', 'gnl_clients', 'normal' );
}
add_action( 'add_meta_boxes', 'prefix_remove_meta_box', 100000 );

That makes the Yoast SEO JavaScript code breaks because it couldn't find the elements to update the SEO results. Removing the code fixes the bug.

I suggest you use CSS to hide Yoast SEO meta box instead of removing it :) Just enqueue a simple CSS file or output CSS in the <head> section.

@rilwis rilwis added review and removed in progress labels May 16, 2016
@joeporterme
Copy link
Author

oh man! thanks so much... i guess its not a bug for meta-box sorry for the goose chase... i guess i wish yoast made it easy to disable on custom post types :(

@rilwis
Copy link
Member

rilwis commented May 16, 2016

Yeah, you should open an issue for Yoast SEO then :). I'm sure they're glad to receive feedback.

@rilwis rilwis closed this as completed May 16, 2016
@rilwis rilwis removed the review label May 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants