• Resolved Jon

    (@freshyjon)


    Previously in version 3, the SEO Title and SEO Description were separate columns when viewing the table of posts or pages. Now in version 4, they seem to be combined into one column.

    We don’t want to show the Description field in any of the admin columns. Do you have a filter to remove this yet? Otherwise, we could keep it, if it rendered shortcodes properly.

    Take a look at this: https://i.imgur.com/5VBUGWa.png

    The actual meta description does properly render on the frontend (within the meta and OG fields). But why not also render it in the backend preview in that column?

    As it is in the screenshot, it looks bad. It’s not a true reflection of what the final description is. It also looks quite bad and confusing if a client were to see that.

    We currently have it set to pull in the #post_excerpt.

    So please:

    • Give us an option (or a filter at the least) to turn off the Description field in that column
    • Render the true output of the Description, instead of showing all the shortcodes
Viewing 13 replies - 1 through 13 (of 13 total)
  • Yes + 1 for
    Give us an option (or a filter at the least) to turn off the Description field in that column
    Render the true output of the Description, instead of showing all the shortcodes

    Plugin Author arnaudbroes

    (@arnaudbroes)

    Hey guys,

    We don’t have a filter to control the display of elements inside our column yet. It’s something we’ll look into though.

    As far as shortcodes go, we currently do not parse them inside the admin area because this is known to cause site breaking conflicts with themes and other plugins, like Avada for instance.

    I’ll see if we can perhaps also add a filter for this so that you can manually enable running shortcodes in the admin.

    – Arnaud

    Thread Starter Jon

    (@freshyjon)

    Is there at least a filter to remove that column for now, so I can remove it for certain users/roles?

    Plugin Author arnaudbroes

    (@arnaudbroes)

    @freshyjon there’s no official filter yet, but for now you can conditionally remove the action that is adding our column by doing something like this –

    add_action( 'init', function() {
    	remove_action( 'current_screen', [ aioseo()->admin, 'addPostColumns' ], 1 );
    } );

    You’d just need to wrap the remove_action in an if statement where you check for the role of the current user.

    – Arnaud

    Thread Starter Jon

    (@freshyjon)

    For now, I’ve implemented this: https://gist.github.com/Garconis/d7125787022eb325426706ac2d19cc5d

    And then changed the domain from example.com to the domain of our in-house admin users. That way, outside admin users won’t be able to see it.

    Though, I’m still hoping for the ability to just remove the “Description” part of the AIOSEO Details column. That way we can show the SEO Title to all users, like we’ve done in the past…

    Thread Starter Jon

    (@freshyjon)

    Looks like this is throwing error, possibly when AIOSEO isn’t activated?

    Fatal error: Uncaught Error: Call to undefined function aioseo() in /srv/users/freshysites/apps/fstemplate/public/wp-content/themes/Divi-child/functions.php:66 Stack trace: #0 /srv/users/freshysites/apps/fstemplate/public/wp-includes/class-wp-hook.php(287): {closure}('') #1 /srv/users/freshysites/apps/fstemplate/public/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters(NULL, Array) #2 /srv/users/freshysites/apps/fstemplate/public/wp-includes/plugin.php(484): WP_Hook->do_action(Array) #3 /srv/users/freshysites/apps/fstemplate/public/wp-settings.php(557): do_action('init') #4 /srv/users/freshysites/apps/fstemplate/public/wp-config.php(83): require_once('/srv/users/fres...') #5 /srv/users/freshysites/apps/fstemplate/public/wp-load.php(37): require_once('/srv/users/fres...') #6 /srv/users/freshysites/apps/fstemplate/public/wp-blog-header.php(13): require_once('/srv/users/fres...') #7 /srv/users/freshysites/apps/fstemplate/public/index.php(17): require('/srv/users/fres...') #8 {main} thrown in /srv/users/freshysites/apps/fstemplate/public/wp-content/themes/Divi-child/functions.php on line 66

    Plugin Author arnaudbroes

    (@arnaudbroes)

    @freshyjon correct, aioseo() returns the main class, so that function wouldn’t exist if the plugin is deactivated.

    Thread Starter Jon

    (@freshyjon)

    OK, so I should wrap with some sort of is_plugin_active first?

    Thread Starter Jon

    (@freshyjon)

    Would this suffice? https://gist.github.com/Garconis/d7125787022eb325426706ac2d19cc5d

    <?php
    function remove_aioseo_details_column(){
    	// enable if AIOSEO is active
    	if ( is_plugin_active( 'all-in-one-seo-pack/all_in_one_seo_pack.php' ) ) {
    		// fires after WordPress has finished loading but before any headers are sent.
    		add_action( 'init', function() {
    			// get current User
    			$user = wp_get_current_user(); 
    			// get their email address
    			$email = $user->user_email;
    			// check the email's domain
    			$domain = 'example.com';
    			// check if email address matches domain list
    			$banned = strpos($email, $domain) === false;
    			// if current user's email addess doesn't match domain list, then hide the AIOSEO column
    			if( $user && $banned ) {
    				// remove the AIOSEO Details column for users without a particular email address domain
    				remove_action( 'current_screen', [ aioseo()->admin, 'addPostColumns' ], 1 );
    			}
    		} );
    	}
    }
    add_action('admin_init' , 'remove_aioseo_details_column');
    • This reply was modified 3 years, 9 months ago by Jon.
    Plugin Author arnaudbroes

    (@arnaudbroes)

    That would suffice, although I think you can also just do a simple function_exists( 'aioseo' ) check.

    Thread Starter Jon

    (@freshyjon)

    Should I still use within admin_init? Or isn’t that necessary?

    <?php
    function remove_aioseo_details_column(){
    	// enable if AIOSEO is active
    	if ( function_exists( 'aioseo' ) ) {
    		// fires after WordPress has finished loading but before any headers are sent.
    		add_action( 'init', function() {
    			// get current User
    			$user = wp_get_current_user(); 
    			// get their email address
    			$email = $user->user_email;
    			// check the email's domain
    			$domain = 'example.com';
    			// check if email address matches domain list
    			$banned = strpos($email, $domain) === false;
    			// if current user's email address doesn't match domain list, then hide the AIOSEO column
    			if( $user && $banned ) {
    				// remove the AIOSEO Details column for users without a particular email address domain
    				remove_action( 'current_screen', [ aioseo()->admin, 'addPostColumns' ], 1 );
    			}
    		} );
    	}
    }
    add_action('admin_init' , 'remove_aioseo_details_column');

    versus:

    <?php
    // enable if AIOSEO is active
    if ( function_exists( 'aioseo' ) ) {
    	// fires after WordPress has finished loading but before any headers are sent.
    	add_action( 'init', function() {
    		// get current User
    		$user = wp_get_current_user(); 
    		// get their email address
    		$email = $user->user_email;
    		// check the email's domain
    		$domain = 'example.com';
    		// check if email address matches domain list
    		$banned = strpos($email, $domain) === false;
    		// if current user's email address doesn't match domain list, then hide the AIOSEO column
    		if( $user && $banned ) {
    			// remove the AIOSEO Details column for users without a particular email address domain
    			remove_action( 'current_screen', [ aioseo()->admin, 'addPostColumns' ], 1 );
    		}
    	} );
    }
    Thread Starter Jon

    (@freshyjon)

    Actually looks like admin_init action isn’t working, as it may be firing at wrong time?

    So, is the second option OK to have, even if/when plugin is deactivated?

    Plugin Author arnaudbroes

    (@arnaudbroes)

    Yep, the second one should be totally fine. The function will simply not exist if the plugin is deactivated, so that’s exactly what you want.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Problems with AIOSEO Details column’ is closed to new replies.