Filter Hooks - AIOSEO https://aioseo.com Thu, 21 Dec 2023 16:07:06 +0000 en-US hourly 1 https://wordpress.org/?v=6.3.1 https://aioseo.com/wp-content/uploads/2020/11/symbol-logo-lg-1.png Filter Hooks - AIOSEO https://aioseo.com 32 32 aioseo_access_control_excluded_roles https://aioseo.com/docs/aioseo_access_control_excluded_roles/?utm_source=rss&utm_medium=rss&utm_campaign=aioseo_access_control_excluded_roles Tue, 24 Aug 2021 16:47:00 +0000 https://aioseo.com/?post_type=documentation&p=49268 Purpose & version added This filter can be used to manage the excluded roles from Access Control. Arguments (1) $roles (array) – A list of roles being ignored. Example code snippet The code snippet below is just an example of…

The post aioseo_access_control_excluded_roles first appeared on AIOSEO.]]>
Purpose & version added

This filter can be used to manage the excluded roles from Access Control.

Arguments (1)

  1. $roles (array) – A list of roles being ignored.

Example code snippet

The code snippet below is just an example of how this filter can be used. In the example below, we’ll remove the customer role from the excluded roles.

// Removes the customer role from the exclusion list.
add_filter( 'aioseo_access_control_excluded_roles', 'aioseo_filter_access_control_excluded_roles' );
function aioseo_filter_access_control_excluded_roles( $roles ) {
	if ( ( $key = array_search( 'customer', $roles ) ) !== false ) {
		unset( $roles[ $key ] );
	}
	return $roles;
}

Changelog

VersionDescription
4.1.4Introduced.
The post aioseo_access_control_excluded_roles first appeared on AIOSEO.]]>
aioseo_breadcrumbs_link_current_item https://aioseo.com/docs/aioseo_breadcrumbs_link_current_item/?utm_source=rss&utm_medium=rss&utm_campaign=aioseo_breadcrumbs_link_current_item Tue, 27 Jul 2021 20:42:52 +0000 https://aioseo.com/?post_type=documentation&p=48232 Purpose This filter can be used to add or remove the link from the current item in the breadcrumb trail. Arguments (1) $linkCurrentItem (boolean) – Keep or remove the link. Example code snippet The code snippet below is just an…

The post aioseo_breadcrumbs_link_current_item first appeared on AIOSEO.]]>
Purpose

This filter can be used to add or remove the link from the current item in the breadcrumb trail.

Arguments (1)

  1. $linkCurrentItem (boolean) – Keep or remove the link.

Example code snippet

The code snippet below is just an example of how this filter can be used. In the example below we’ll remove the link from the current breadcrumb item if we’re on a page.

// Removes the link of the last crumb if it's a page.
add_filter( 'aioseo_breadcrumbs_link_current_item', 'aioseo_breadcrumbs_link_current_item', 10 );
function aioseo_breadcrumbs_link_current_item( $linkCurrentItem ) {
	if ( is_singular( 'page' ) ) {
		$linkCurrentItem = false;
	}

	return $linkCurrentItem;
}

The post aioseo_breadcrumbs_link_current_item first appeared on AIOSEO.]]>
aioseo_breadcrumbs_output https://aioseo.com/docs/aioseo_breadcrumbs_output/?utm_source=rss&utm_medium=rss&utm_campaign=aioseo_breadcrumbs_output Tue, 27 Jul 2021 20:40:29 +0000 https://aioseo.com/?post_type=documentation&p=48219 Purpose This filter can be used to control the display of breadcrumbs (show or hide). Arguments (1) $display (boolean) – Show or hide. Example code snippet The code snippet below is just an example of how this filter can be…

The post aioseo_breadcrumbs_output first appeared on AIOSEO.]]>
Purpose

This filter can be used to control the display of breadcrumbs (show or hide).

Arguments (1)

  1. $display (boolean) – Show or hide.

Example code snippet

The code snippet below is just an example of how this filter can be used. In the example below we’ll hide the breadcrumbs on pages.

// Hide breadcrumbs on pages.
add_filter( 'aioseo_breadcrumbs_output', 'aioseo_breadcrumbs_output' );
function aioseo_breadcrumbs_output( $display ) {
	if ( is_singular( 'page' ) ) {
		$display = false;
	}

	return $display;
}

The post aioseo_breadcrumbs_output first appeared on AIOSEO.]]>
aioseo_breadcrumbs_separator https://aioseo.com/docs/aioseo_breadcrumbs_separator/?utm_source=rss&utm_medium=rss&utm_campaign=aioseo_breadcrumbs_separator Tue, 27 Jul 2021 20:39:22 +0000 https://aioseo.com/?post_type=documentation&p=48223 Purpose This filter can be used to change the separator, including HTML, used between breadcrumbs. Arguments (1) $separator (string) – The separator html. Example code snippet The code snippet below is just an example of how this filter can be…

The post aioseo_breadcrumbs_separator first appeared on AIOSEO.]]>
Purpose

This filter can be used to change the separator, including HTML, used between breadcrumbs.

Arguments (1)

  1. $separator (string) – The separator html.

Example code snippet

The code snippet below is just an example of how this filter can be used. In the example below we’ll change the separator html on pages.

// Change separator on pages.
add_filter( 'aioseo_breadcrumbs_separator', 'aioseo_breadcrumbs_separator' );
function aioseo_breadcrumbs_separator( $separator ) {
	if ( is_singular( 'page' ) ) {
		$separator = '<span class="my-separator">-></span>';
	}

	return $separator;
}

The post aioseo_breadcrumbs_separator first appeared on AIOSEO.]]>
aioseo_breadcrumbs_separator_symbol https://aioseo.com/docs/aioseo_breadcrumbs_separator_symbol/?utm_source=rss&utm_medium=rss&utm_campaign=aioseo_breadcrumbs_separator_symbol Tue, 27 Jul 2021 20:47:17 +0000 https://aioseo.com/?post_type=documentation&p=48222 Purpose This filter can be used to change the breadcrumb separator symbol. Arguments (1) $symbol (string) – The symbol. Example code snippet The code snippet below is just an example of how this filter can be used. In the example…

The post aioseo_breadcrumbs_separator_symbol first appeared on AIOSEO.]]>
Purpose

This filter can be used to change the breadcrumb separator symbol.

Arguments (1)

  1. $symbol (string) – The symbol.

Example code snippet

The code snippet below is just an example of how this filter can be used. In the example below we’ll change the separator symbol on pages.

// Change breadcrumb separator on pages.
add_filter( 'aioseo_breadcrumbs_separator_symbol', 'aioseo_breadcrumbs_separator_symbol' );
function aioseo_breadcrumbs_separator_symbol( $symbol ) {
	if ( is_singular( 'page' ) ) {
		$symbol = '->';
	}

	return $symbol;
}

The post aioseo_breadcrumbs_separator_symbol first appeared on AIOSEO.]]>
aioseo_breadcrumbs_show_current_item https://aioseo.com/docs/aioseo_breadcrumbs_show_current_item/?utm_source=rss&utm_medium=rss&utm_campaign=aioseo_breadcrumbs_show_current_item Tue, 27 Jul 2021 20:41:32 +0000 https://aioseo.com/?post_type=documentation&p=48233 Purpose This filter can be used to show or hide the current item in the breadcrumb trail. Arguments (3) $showCurrentItem (boolean) – Show or hide. $type (string) – The type of breadcrumb. $reference (array) – The reference for the current…

The post aioseo_breadcrumbs_show_current_item first appeared on AIOSEO.]]>
Purpose

This filter can be used to show or hide the current item in the breadcrumb trail.

Arguments (3)

  1. $showCurrentItem (boolean) – Show or hide.
  2. $type (string) – The type of breadcrumb.
  3. $reference (array) – The reference for the current item crumb.

Example code snippet

The code snippet below is just an example of how this filter can be used. In the example below we’ll hide the last crumb on pages.

// Hide the last crumb if it's a page.
add_filter( 'aioseo_breadcrumbs_show_current_item', 'aioseo_breadcrumbs_show_current_item', 10, 3 );
function aioseo_breadcrumbs_show_current_item( $showCurrentItem, $type, $reference ) {
	if ( is_singular( 'page' ) ) {
		$showCurrentItem = false;
	}

	return $showCurrentItem;
}

The post aioseo_breadcrumbs_show_current_item first appeared on AIOSEO.]]>
aioseo_breadcrumbs_template https://aioseo.com/docs/aioseo_breadcrumbs_template/?utm_source=rss&utm_medium=rss&utm_campaign=aioseo_breadcrumbs_template Tue, 27 Jul 2021 20:46:07 +0000 https://aioseo.com/?post_type=documentation&p=48227 Purpose This filter can be used to change the HTML template for a specific crumb in the breadcrumbs trail. Arguments (2) $templateItem (string) – The crumb template. $crumb (array) – The crumb information. Example code snippet The code snippet below…

The post aioseo_breadcrumbs_template first appeared on AIOSEO.]]>
Purpose

This filter can be used to change the HTML template for a specific crumb in the breadcrumbs trail.

Arguments (2)

  1. $templateItem (string) – The crumb template.
  2. $crumb (array) – The crumb information.

Example code snippet

The code snippet below is just an example of how this filter can be used. In the example below we’ll change the HTML if it’s the crumb of the ‘uncategorized’ category. This change will remove the <a> link to that category.

// Change the crumb html template for the uncategorized category removing it's link.
add_filter( 'aioseo_breadcrumbs_template', 'aioseo_breadcrumbs_template', 10, 2 );
function aioseo_breadcrumbs_template( $templateItem, $crumb ) {
	if ( is_a( $crumb['reference'], 'WP_Term' ) && 'uncategorized' === $crumb['reference']->slug ) {
		$templateItem['template'] = '<span class="aioseo-breadcrumb">
			#breadcrumb_label
		</span>';
	}

	return $templateItem;
}

The post aioseo_breadcrumbs_template first appeared on AIOSEO.]]>
aioseo_breadcrumbs_trail https://aioseo.com/docs/aioseo_breadcrumbs_trail/?utm_source=rss&utm_medium=rss&utm_campaign=aioseo_breadcrumbs_trail Tue, 27 Jul 2021 20:44:35 +0000 https://aioseo.com/?post_type=documentation&p=48231 Purpose This filter can be used to change, add or remove any crumb in the breadcrumbs trail. Arguments (1) $crumbs (array) – An array of crumbs. Example code snippet The code snippet below is just an example of how this…

The post aioseo_breadcrumbs_trail first appeared on AIOSEO.]]>
Purpose

This filter can be used to change, add or remove any crumb in the breadcrumbs trail.

Arguments (1)

  1. $crumbs (array) – An array of crumbs.

Example code snippet

The code snippet below is just an example of how this filter can be used. In the example below we’ll remove the crumb for the ‘uncategorized’ category.

// Remove the crumb for the uncategorized category.
add_filter( 'aioseo_breadcrumbs_trail', 'aioseo_breadcrumbs_trail' );
function aioseo_breadcrumbs_trail( $crumbs ) {
	foreach ( $crumbs as $key => $crumb ) {
		if ( is_a( $crumb['reference'], 'WP_Term' ) && 'uncategorized' === $crumb['reference']->slug ) {
			unset( $crumbs[ $key ] );
		}
	}

	return $crumbs;
}

The post aioseo_breadcrumbs_trail first appeared on AIOSEO.]]>
aioseo_canonical_url https://aioseo.com/docs/aioseo_canonical_url/?utm_source=rss&utm_medium=rss&utm_campaign=aioseo_canonical_url Mon, 28 Dec 2020 13:30:04 +0000 https://aioseo.com/?post_type=documentation&p=23717 Purpose This filter can be used to filter the canonical URL. Arguments (1) $url (string) – The canonical URL. Example code snippet The code snippet below is just an example of how this filter can be used. In the example…

The post aioseo_canonical_url first appeared on AIOSEO.]]>
Purpose

This filter can be used to filter the canonical URL.

Arguments (1)

  1. $url (string) – The canonical URL.

Example code snippet

The code snippet below is just an example of how this filter can be used. In the example below, AIOSEO is prevented from outputting a canonical URL for posts.

add_filter( 'aioseo_canonical_url', 'aioseo_filter_canonical_url' );

function aioseo_filter_canonical_url( $url ) {
   if ( is_singular() ) {
      return '';
   }
   return $url;
}
The post aioseo_canonical_url first appeared on AIOSEO.]]>
aioseo_classic_editor_disable_emoji_script https://aioseo.com/docs/aioseo_classic_editor_disable_emoji_script/?utm_source=rss&utm_medium=rss&utm_campaign=aioseo_classic_editor_disable_emoji_script Wed, 05 May 2021 06:59:26 +0000 https://aioseo.com/?post_type=documentation&p=37961 Purpose This filter can be used to disable the emoji image conversion script of the Classic Editor plugin in order to fix emoji support in the metabox fields of All in One SEO. Arguments (1) $disabled (boolean) – Whether the…

The post aioseo_classic_editor_disable_emoji_script first appeared on AIOSEO.]]>
Purpose

This filter can be used to disable the emoji image conversion script of the Classic Editor plugin in order to fix emoji support in the metabox fields of All in One SEO.

Arguments (1)

  1. $disabled (boolean) – Whether the script should be disabled. Defaults to false.

Example code snippet

add_filter( 'aioseo_classic_editor_disable_emoji_script', '__return_true' );
The post aioseo_classic_editor_disable_emoji_script first appeared on AIOSEO.]]>