WordPress.org

Forums

Yoast SEO
[resolved] [Plugin: WordPress SEO by Yoast] Breaks other plugins which add custom columns (3 posts)

  1. Andrew Biss
    Member
    Posted 4 years ago #

    Great plugin!

    I noticed a minor problem with WordPress SEO where it does not play nicely with other plugins or themes which define custom columns in the Manage Posts and/or Manage Pages lists.

    The issue is that in wordpress-seo\admin\class-metabox.php the custom columns are defined with this function:

    function page_title_column_heading( $columns ) {
       return array_merge(array_slice($columns, 0, 2),
       array('page-title' => 'WP SEO Title'),
       array_slice($columns, 2, 6),
       array('page-meta-robots' => 'Robots Meta'));
    }

    This code assumes when splitting up the array of columns that nobody else has defined any custom columns. The result is that the associative array of column names gets truncated and only the first 7 columns that were already defined (plus the 2 from WordPress SEO) are displayed.

    As a workaround I patched the code to change the hardcoded array upper limit of 6 to count($columns) as follows:

    function page_title_column_heading( $columns ) {
       return array_merge(array_slice($columns, 0, 2),
       array('page-title' => 'WP SEO Title'),
       array_slice($columns, 2, count($columns)),
       array('page-meta-robots' => 'Robots Meta'));
    }

    With these change my custom columns along with those from WordPress SEO are available and I can hide and show the ones I need from the "Screen Options" panel.

    Andrew.

    http://wordpress.org/extend/plugins/wordpress-seo/

  2. Andrew Biss
    Member
    Posted 4 years ago #

    Fixed OK in version 0.2.3

  3. Joost de Valk
    Member
    Plugin Author

    Posted 4 years ago #

    Perfect.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Yoast SEO
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic