Current File : /home/pacjaorg/wpt.pacja.org/wp-content/uploads/wpcode/cache/library/profile_aioseo.json
{"categories":[{"name":"AIOSEO Team","slug":"aioseo"}],"snippets":[{"library_id":24504,"title":"Add 'excerpt' and 'page-attributes' Support to Locations Post Type","code":"add_filter( 'aioseo_local_business_post_type', 'aioseo_change_local_business_post_type' );\r\n\r\nfunction aioseo_change_local_business_post_type( $post_type ) {\r\n\t$post_type['supports'][] = 'excerpt';\r\n\t$post_type['supports'][] = 'page-attributes';\r\n\r\n\treturn $post_type;\r\n}","note":"This filter can be used to add 'excerpt' and 'page-attributes' support to Locations post type","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24081,"title":"Add \u2018LLC\u2019 to the Local SEO Business Name","code":"add_filter( 'aioseo_local_business_output_business_info_location_data', 'aioseo_change_local_business_output_business_info_location_data', 10, 3 );\r\n\r\nfunction aioseo_change_local_business_output_business_info_location_data( $locationData, $instance, $postId ) {\r\n\t$locationData->name .= ' LLC';\r\n\r\n\treturn $locationData;\r\n}","note":"This filter can be used to add \u2018LLC\u2019 to the Local SEO Business Name","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24359,"title":"Add Additional Custom Sitemap Index","code":"add_filter( 'aioseo_sitemap_indexes', 'aioseo_add_sitemap_index' );\r\n\r\nfunction aioseo_add_sitemap_index( $indexes ) {\r\n\t$indexes[] = [\r\n\t\t'loc'     => 'https:\/\/somedomain.com\/custom-sitemap.xml',\r\n\t\t'lastmod' => aioseo()->helpers->dateTimeToIso8601( '2021-09-08 12:02' ),\r\n\t\t'count'   => 1000\r\n\t];\r\n\treturn $indexes;\r\n}\r\n","note":"This filter can be used to add an Additional Custom Sitemap Index to the root...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24014,"title":"Add Another Meta Keyword to Each Post","code":"add_filter( 'aioseo_keywords', 'aioseo_filter_keywords' );\r\n\r\nfunction aioseo_filter_keywords( $keywords ) {\r\n   if ( is_singular() ) {\r\n      $keywords = explode( ',', $keywords );\r\n      array_push( $keywords, 'anotherkeyword' );\r\n      $keywords = implode( ',', $keywords );\r\n   }\r\n   return $keywords ;\r\n}","note":"This filter can be used to add another meta keyword to each post. You can...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":17299,"title":"Add author name to article schema if its missing","code":"add_filter( 'aioseo_schema_output', 'add_author_name_when_missing' );\r\nfunction add_author_name_when_missing( $schema ) {\t\r\n\tif ( is_single() && 'post' == get_post_type() ) {\r\n\t\tglobal $post;\r\n\t\t$author_id = $post->post_author;\r\n\t\t$author_name = get_the_author_meta( 'display_name', $author_id );\r\n\r\n\t\tforeach ( $schema as &$schemaItem ) {\r\n\t\t\tif ( isset($schemaItem['@type']) && 'Article' === $schemaItem['@type'] ) {\r\n\t\t\t\tif(!isset($schemaItem['author']['name']) || !isset($schemaItem['author']['@type'])){\r\n\t\t\t\t\t$schemaItem['author']['@type'] = 'Person';\r\n\t\t\t\t\t$schemaItem['author']['name'] = $author_name;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn $schema;\r\n}","note":"This snippet adds the author's name and author schema type to the article schema if...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":26412,"title":"Add Custom Element to Breadcrumbs","code":"add_filter( 'aioseo_breadcrumbs_trail', function( $crumbs ) {\r\n    if(is_singular('post') || is_category()){\r\n\t\t$blog = [\r\n\t\t\t'label' => 'Resources',\r\n\t\t\t'link' => 'https:\/\/whatisnosy.com\/resources',\r\n\t\t\t'type' => ''\r\n\t\t];\r\n\t\tarray_splice( $crumbs, 0, 0, [$blog] );\r\n\t}\r\n    return $crumbs;\r\n}, 10, 2);","note":"This snippet adds a custom Element called \"Resources\" (with its link) as the 1st element...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":19824,"title":"Add deliveryTime schema to shippingDetails schema","code":"add_filter( 'aioseo_schema_output', function ( $schema ) {\r\n    foreach ( $schema as &$schemaItem ) {\r\n        if ( isset( $schemaItem['@type'] ) && 'Product' === $schemaItem['@type'] ) {\r\n\t\t\tif(!empty($schemaItem[\"offers\"][\"shippingDetails\"])){\r\n\t\t\t\t\/\/ Loop inside the Offers > shippingDetails schema\r\n\t\t\t\tforeach( $schemaItem[\"offers\"][\"shippingDetails\"] as &$schemaItemChild ){\r\n\t\t\t\t\/\/ Check for OfferShippingDetails schema where we need to add the deliveryTime schema\r\n\t\t\t\tif( isset( $schemaItemChild['@type'] ) && 'OfferShippingDetails' === $schemaItemChild['@type'] ){\r\n\t\t\t\t\t\/\/ Adding the deliveryTime schema\r\n\t\t\t\t\t$schemaItemChild[\"deliveryTime\"] = [\r\n\t\t\t\t\t\t\"@type\" => \"ShippingDeliveryTime\",\r\n\t\t\t\t\t\t\"handlingTime\" => [\r\n\t\t\t\t\t\t\t\"@type\" => \"QuantitativeValue\",\r\n\t\t\t\t\t\t\t\"minValue\" => 1,\r\n\t\t\t\t\t\t\t\"maxValue\" => 2,\r\n\t\t\t\t\t\t\t\"unitCode\" => \"d\"\r\n\t\t\t\t\t\t],\r\n\t\t\t\t\t\t\"transitTime\" => [\r\n\t\t\t\t\t\t\t\"@type\" => \"QuantitativeValue\",\r\n\t\t\t\t\t\t\t\"minValue\" => 1,\r\n\t\t\t\t\t\t\t\"maxValue\" => 3,\r\n\t\t\t\t\t\t\t\"unitCode\" => \"d\"\r\n\t\t\t\t\t\t]\r\n\t\t\t\t\t];\r\n\t\t\t\t}\r\n\t\t\t}\t\t\r\n\t\t\t}\t\r\n        }\r\n    }\r\n\r\n    return $schema;\r\n}, 10, 2 );","note":"This snippet adds deliveryTime schema to shippingDetails schema that's present inside the Product > Offers...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24358,"title":"Add Image to Sitemap From an Image ACF Field","code":"add_filter( 'aioseo_sitemap_images', 'aioseo_filter_sitemap_images', 10, 2 );\r\nfunction aioseo_filter_sitemap_images( $images, $post ) {\r\n\tif ( ! function_exists( 'get_field' ) ) {\r\n\t\treturn $images;\r\n\t}\r\n\r\n\t$customImage = get_field( 'custom_image', $post->ID );\r\n\tif ( ! empty( $customImage ) ) {\r\n\t\t$images[] = wp_get_attachment_image_url( $customImage['id'] );\r\n\t}\r\n\r\n\treturn $images;\r\n}","note":"This filter can be used to add an image from an Image ACF field with...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":17768,"title":"Add missing mainEntity to ProfilePage Schema","code":"add_filter( 'aioseo_schema_output', function ( $schema ) {\r\n\tforeach ( $schema as &$schemaItem ) {\r\n\t\tif (\r\n\t\t\tempty( $schemaItem['mainEntity'] ) &&\r\n\t\t\tisset( $schemaItem['@type'] ) &&\r\n\t\t\t'ProfilePage' === $schemaItem['@type']\r\n\t\t) {\r\n\t\t\tglobal $wp;\r\n\r\n\t\t\t$current_url              = untrailingslashit( home_url( $wp->request ) );\r\n\t\t\t$schemaItem['mainEntity'] = [\r\n\t\t\t\t'@id' => $current_url . '\/#author'\r\n\t\t\t];\r\n\t\t}\r\n\t}\r\n\r\n\treturn $schema;\r\n} );","note":"This snippet adds missing mainEntity to ProfilePage Schema","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24150,"title":"Add Noindex & Nofollow Attributes to all the Posts","code":"add_filter( 'aioseo_robots_meta', 'aioseo_filter_robots_meta' );\r\n\r\nfunction aioseo_filter_robots_meta( $attributes ) {\r\n   if ( is_singular() ) {\r\n      $attributes['noindex']  = 'noindex';\r\n      $attributes['nofollow'] = 'nofollow';\r\n   }\r\n   return $attributes;\r\n}","note":"This filter can be used to add Noindex & Nofollow attributes to all the Posts","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24496,"title":"Add Shortcodes to the List of Conflicting Shortcodes","code":"add_filter( 'aioseo_conflicting_shortcodes', 'aioseo_filter_conflicting_shortcodes' );\r\n\r\nfunction aioseo_filter_conflicting_shortcodes( $conflictingShortcodes ) {\r\n   $conflictingShortcodes = array_merge( $conflictingShortcodes, [\r\n\t\t'WISDM Group Registration' => '[wdm_group_users]',\r\n\t\t'WISDM Quiz Reporting'     => '[wdm_quiz_statistics_details]',\r\n\t\t'WISDM Course Review'      => '[rrf_course_review]'\r\n   ] );\r\n   return $conflictingShortcodes;\r\n}","note":"Add shortcodes to the list of conflicting shortcodes","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24075,"title":"Add String to the Local SEO Business Name","code":"add_filter( 'aioseo_local_business_get_location', 'aioseo_change_local_business_get_location', 10, 2 );\r\n\r\nfunction aioseo_change_local_business_get_location( $information, $postId ) {\r\n\tif ( 19 === $postId ) {\r\n\t\t$information->locations->business->name .= ' LLC';\r\n\t}\r\n\r\n\treturn $information;\r\n}","note":"This filter can be used to add a string to the Local SEO Business Name....","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":17615,"title":"Add the type property to that Image property in the Organization schema","code":"add_filter( 'aioseo_schema_output', 'add_author_name_when_missing' );\r\nfunction add_author_name_when_missing( $schema ) {\t\r\n\t\tforeach ( $schema as &$schemaItem ) {\r\n\t\t\tif ( isset($schemaItem['@type']) && 'Organization' === $schemaItem['@type'] ) {\r\n\t\t\t\tif(!isset($schemaItem['image']['@type'])){\r\n\t\t\t\t\t$schemaItem['image']['@type'] = 'ImageObject';\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\treturn $schema;\r\n}","note":"This snippet will add the 'ImageObject' type property in the 'Organization' schema markup.","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24360,"title":"Add Translated Version Sitemap Entries for a Specific Post","code":"add_filter( \"aioseo_sitemap_post\", \"aioseo_filter_sitemap_post\", 10, 2 );\r\n\r\nfunction aioseo_filter_sitemap_post( $entry, $postId ) {\r\n\tif ( 10 === $postId ) {\r\n\t\t\/\/ Set the language code for the main URL.\r\n        $entry['language']  = 'en_US'\r\n\r\n\t\t\/\/ Add the translated versions (language code + URL).\r\n\t\t$entry['languages'] = [\r\n\t\t\t[\r\n\t\t\t\t'language' => 'en_CA'\r\n\t\t\t\t'location' => 'https:\/\/example.com\/ca\/page\r\n\t\t\t],\r\n\t\t\t[\r\n\t\t\t\t'language' => 'en_UK'\r\n\t\t\t\t'location' => 'https:\/\/example.com\/uk\/page\r\n\t\t\t]\r\n\t\t];\r\n\t}\r\n\treturn $entry;\r\n}","note":"This filter can be used to add Translated Version Sitemap Entries for a Specific Post....","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24364,"title":"Add Translated Version Sitemap Entries for a Specific Term","code":"add_filter( \"aioseo_sitemap_term\", \"aioseo_filter_sitemap_term\", 10, 2 );\r\n\r\nfunction aioseo_filter_sitemap_term( $entry, $termId ) {\r\n\tif ( 12 === $termId) {\r\n\t\t\/\/ Set the language code for the main URL.\r\n        $entry['language']  = 'en_US'\r\n\r\n\t\t\/\/ Add the translated versions (language code + URL).\r\n\t\t$entry['languages'] = [\r\n\t\t\t[\r\n\t\t\t\t'language' => 'en_CA'\r\n\t\t\t\t'location' => 'https:\/\/example.com\/ca\/page\r\n\t\t\t],\r\n\t\t\t[\r\n\t\t\t\t'language' => 'en_UK'\r\n\t\t\t\t'location' => 'https:\/\/example.com\/uk\/page\r\n\t\t\t]\r\n\t\t];\r\n\t}\r\n\treturn $entry;\r\n}","note":"This filter can be used to add Translated Version Sitemap Entries for a Specific Term....","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":17103,"title":"AIOSEO - Increase SEO Analyzer TimeOut","code":"add_filter( 'http_request_args', 'aioseo_filter_analyzer_timeout', 1, 2 );\r\n\r\nfunction aioseo_filter_analyzer_timeout( $args, $url ) {\r\n\r\nif ( 'https:\/\/analyze.aioseo.com\/v1\/analyze\/' === $url ) {\r\n\r\n$args['timeout'] = 120;\r\n\r\n}\r\n\r\nreturn $args;\r\n\r\n}","note":"This snippet will increase the Timeout limit set for the SEO Analysis feature on a...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24366,"title":"Allow Users Without Editing Permissions to Edit Their Author SEO Details","code":"add_filter( 'aioseo_user_profile_tab_allowed_user_ids', 'aioseo_profile_tab_allowed_users', 10, 2 );\r\nfunction aioseo_profile_tab_allowed_users( $user_ids, $user_id ) {\r\n\tif ( ! user_can( $user_id, 'edit_posts' ) ) {\r\n\t\t$user_ids[] = $user_id;\r\n\t}\r\n\r\n\treturn $user_ids;\r\n}\r\n","note":"This filter can be used to allow users that don\u2019t have editing permissions to edit...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24156,"title":"Append a Page to the Additional Pages Sitemap","code":"add_filter( 'aioseo_sitemap_additional_pages', 'aioseo_sitemap_add_additional_pages' );\r\n\r\nfunction aioseo_sitemap_add_additional_pages( $pages ) {\r\n\t$pages[] = [\r\n\t\t'loc'        => 'https:\/\/example.com\/additional-page',\r\n\t\t'lastmod'    => '2020-12-11 11:11',\r\n\t\t'changefreq' => 'always',\r\n\t\t'priority'   => (float) 1.0\r\n\t];\r\n\treturn $pages;\r\n}","note":"This filter can be used to Append a Page to the Additional Pages Sitemap","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24000,"title":"Append a string to the Meta Description of each post","code":"add_filter( 'aioseo_description', 'aioseo_filter_description' );\r\n\r\nfunction aioseo_filter_description( $description ) {\r\n   if ( is_singular() ) {\r\n      return $description . 'some additional description content here';\r\n   }\r\n   return $description;\r\n}","note":"This snippet can be used to append a string to the Meta Description of each...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":23989,"title":"Append specific string to the SEO Title of each post","code":"add_filter( 'aioseo_title', 'aioseo_filter_title' );\r\n\r\nfunction aioseo_filter_title( $title ) {\r\n   if ( is_singular() ) {\r\n      return $title . 'some additional title content here';\r\n   }\r\n   return $title;\r\n}","note":"This snippet can be used to append a specific string to the SEO Title of...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24074,"title":"Change 'streetLineTwo' in Local SEO address output to an empty string","code":"add_filter( 'aioseo_local_business_address_tag_value', 'aioseo_change_local_business_address_tag_value', 10, 3 );\r\n\r\nfunction aioseo_change_local_business_address_tag_value( $tagValue, $tag, $id ) {\r\n\tif ( 'streetLineTwo' === $tag['id'] ) {\r\n\t\t$tagValue = '';\r\n\t}\r\n\r\n\treturn $tagValue;\r\n}","note":"This filter can be used to change 'streetLineTwo' in Local SEO address output to an...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24151,"title":"Change Breadcrumb Homepage Name in Schema","code":"add_filter( 'aioseo_schema_breadcrumbs_home', 'aioseo_filter_schema_breadcrumbs_home' );\r\n\r\nfunction aioseo_filter_schema_breadcrumbs_home( $name ) {\r\n   return 'Homepage';\r\n}","note":"This filter can be used to change breadcrumb Homepage name in schema to 'Homepage'. IMPORTANT...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24076,"title":"Change Business Info Email Icon","code":"add_filter( 'aioseo_local_business_info_email_icon', 'aioseo_change_local_business_info_email_icon');\r\n\r\nfunction aioseo_change_local_business_info_email_icon( $icon ) {\r\n\treturn '<img src=\"'.get_template_directory_uri().'\/assets\/images\/email-icon.png\"\/>';\r\n}","note":"This filter can be used to change the business info email icon. Replace \"\/assets\/images\/email-icon.png\" with...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24077,"title":"Change Business Info Location Icon","code":"add_filter( 'aioseo_local_business_info_location_icon', 'aioseo_change_local_business_info_location_icon');\r\n\r\nfunction aioseo_change_local_business_info_location_icon( $icon ) {\r\n\treturn '<img src=\"'.get_template_directory_uri().'\/assets\/images\/location-icon.png\"\/>';\r\n}","note":"This filter can be used to change the business info location icon. Replace \"\/assets\/images\/email-icon.png\" with...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24079,"title":"Change Business Info Opening Hours Icon","code":"add_filter( 'aioseo_local_business_opening_hours_icon', 'aioseo_change_local_business_opening_hours_icon');\r\n\r\nfunction aioseo_change_local_business_opening_hours_icon( $icon ) {\r\n\treturn '<img src=\"'.get_template_directory_uri().'\/assets\/images\/hours-icon.png\"\/>';\r\n}","note":"This filter can be used to change the business info Opening Hours icon. Replace \"\/assets\/images\/email-icon.png\"...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24078,"title":"Change Business Info Phone Icon","code":"add_filter( 'aioseo_local_business_info_phone_icon', 'aioseo_change_local_business_info_phone_icon');\r\n\r\nfunction aioseo_change_local_business_info_phone_icon( $icon ) {\r\n\treturn '<img src=\"'.get_template_directory_uri().'\/assets\/images\/phone-icon.png\"\/>';\r\n}","note":"This filter can be used to change the business info phone icon. Replace \"\/assets\/images\/email-icon.png\" with...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24086,"title":"Change Default Post Type Name \u201caioseo-location\u201d","code":"add_filter( 'aioseo_local_business_post_type_name', 'aioseo_change_local_business_post_type_name' );\r\n\r\nfunction aioseo_change_local_business_post_type_name( $name ) {\r\n\t$name = 'franchise-location';\r\n\treturn $name;\r\n}","note":"This filter can be used to change the default post type name from \u201caioseo-location\u201d to...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24088,"title":"Change Default Post Type Plural Label \u201cLocations\u201d","code":"add_filter( 'aioseo_local_business_post_type_plural_label', 'aioseo_change_local_business_post_type_plural_label' );\r\n\r\nfunction aioseo_change_local_business_post_type_plural_label( $label ) {\r\n\t$label = 'Franchises';\r\n\treturn $label;\r\n}","note":"This filter can be used to change the default post type plural label from \u201cLocations\u201d...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24089,"title":"Change Default Post Type Singular Label \u201cLocation\u201d","code":"add_filter( 'aioseo_local_business_post_type_single_label', 'aioseo_change_local_business_post_type_single_label' );\r\n\r\nfunction aioseo_change_local_business_post_type_single_label( $label ) {\r\n\t$label = 'Franchise';\r\n\treturn $label;\r\n}","note":"This filter can be used to change the default post type singular label from \u201cLocation\u201d...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24090,"title":"Change Default Post Type Slug \u201clocation\u201d","code":"add_filter( 'aioseo_local_business_post_type_slug', 'aioseo_change_local_business_post_type_slug' );\r\n\r\nfunction aioseo_change_local_business_post_type_slug( $slug ) {\r\n\t$slug = 'franchise';\r\n\treturn $slug;\r\n}","note":"This filter can be used to change the default post type slug from \u201clocation\u201d to...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24091,"title":"Change Location Taxonomy Options When its Registered","code":"add_filter( 'aioseo_local_business_taxonomy', 'aioseo_change_local_business_taxonomy' );\r\n\r\nfunction aioseo_change_local_business_taxonomy( $taxonomy ) {\r\n\t$taxonomy['hierarchical'] = true;\r\n\treturn $taxonomy;\r\n}","note":"This filter can be used to change the taxonomy option to \u2018hierarchical\u2019","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24004,"title":"Change OG Title of a Specific Post","code":"add_filter( 'aioseo_facebook_tags', 'aioseo_filter_facebook_title' );\r\n\r\nfunction aioseo_filter_facebook_title( $facebookMeta ) {\r\n   if ( is_singular() && 14 === get_the_ID() ) {\r\n      $facebookMeta['og:title'] = \"A different title\";\r\n   }\r\n   return $facebookMeta;\r\n}","note":"This filter can be used to change the OG Title of a Specific Post with...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24082,"title":"Change Opening Hours Closed Label","code":"add_filter( 'aioseo_local_business_output_opening_hours_data', 'aioseo_change_local_business_output_opening_hours_data', 10, 3 );\r\n\r\nfunction aioseo_change_local_business_output_opening_hours_data( $openingHoursData, $instance, $postId ) {\r\n\t$openingHoursData->labels->closed = __( 'Closed today.' );\r\n\r\n\treturn $openingHoursData;\r\n}","note":"This filter can be used to change the closed label of Opening Hours. Replace 'Closed...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":16995,"title":"Change Schema Type of All Posts in Specific Categories","code":"add_filter('aioseo_schema_output', 'change_schema_type_in_specific_categories');\r\n\r\nfunction change_schema_type_in_specific_categories($schema) {\r\n    \/\/ Specify the category slugs you want to target\r\n    $target_category_slugs = array('category1-slug', 'category2-slug', 'category3-slug');\r\n\r\n    foreach ($schema as &$schemaItem) {\r\n        \/\/ Check if the post belongs to any of the specified categories\r\n        if (isset($schemaItem['@type']) && 'NewsArticle' === $schemaItem['@type'] && has_category($target_category_slugs)) {\r\n            $schemaItem['@type'] = 'Article';\r\n\t\t\tunset($schemaItem['dateline']);\r\n        }\r\n    }\r\n\r\n    return $schema;\r\n}","note":"This snippet changes the 'NewsArticle' schema of all posts under specific categories to 'Article' schema....","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24092,"title":"Change the Default Taxonomy Name \u201caioseo-location-category\u201d","code":"add_filter( 'aioseo_local_business_taxonomy_name', 'aioseo_change_local_business_taxonomy_name' );\r\n\r\nfunction aioseo_change_local_business_taxonomy_name( $name ) {\r\n\t$name = 'franchise-state';\r\n\treturn $name;\r\n}","note":"This filter can be used to change the default taxonomy name \u201caioseo-location-category\u201d.","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24093,"title":"Change the Default Taxonomy Slug \u201clocations-category\u201d","code":"add_filter( 'aioseo_local_business_taxonomy_slug', 'aioseo_change_local_business_taxonomy_slug' );\r\n\r\nfunction aioseo_change_local_business_taxonomy_slug( $slug ) {\r\n\t$slug = 'franchise-state';\r\n\treturn $slug;\r\n}","note":"This filter can be used to change the default taxonomy slug \u201clocations-category\u201d.","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":23997,"title":"Change the HTML template for a specific crumb in the breadcrumbs trail","code":"add_filter( 'aioseo_breadcrumbs_template', 'aioseo_breadcrumbs_template', 10, 2 );\r\nfunction aioseo_breadcrumbs_template( $templateItem, $crumb ) {\r\n\tif ( is_a( $crumb['reference'], 'WP_Term' ) && 'uncategorized' === $crumb['reference']->slug ) {\r\n\t\t$templateItem['template'] = '<span class=\"aioseo-breadcrumb\">\r\n\t\t\t#breadcrumb_label\r\n\t\t<\/span>';\r\n\t}\r\n\r\n\treturn $templateItem;\r\n}","note":"This snippet can be used to change the HTML if it\u2019s the crumb of the...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":25102,"title":"Change the Post ID Being Processed by AIOSEO","code":"add_filter( 'aioseo_get_post_id', 'aioseo_change_post_id' );\r\nfunction aioseo_change_post_id( $postId ) {\r\n\tif( is_post_type_archive( 'product' ) ) {\r\n\t\t$postId = 123;\r\n\t}\r\n\r\n\treturn $postId;\r\n}","note":"This snippet can be used to change the Post ID being processed by AIOSEO.","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":23994,"title":"Change the separator html on pages","code":"add_filter( 'aioseo_breadcrumbs_separator', 'aioseo_breadcrumbs_separator' );\r\nfunction aioseo_breadcrumbs_separator( $separator ) {\r\n\tif ( is_singular( 'page' ) ) {\r\n\t\t$separator = '<span class=\"my-separator\">-><\/span>';\r\n\t}\r\n\r\n\treturn $separator;\r\n}","note":"This snippet can be used to change the separator html on pages","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":23995,"title":"Change the separator symbol on pages","code":"add_filter( 'aioseo_breadcrumbs_separator_symbol', 'aioseo_breadcrumbs_separator_symbol' );\r\nfunction aioseo_breadcrumbs_separator_symbol( $symbol ) {\r\n\tif ( is_singular( 'page' ) ) {\r\n\t\t$symbol = '->';\r\n\t}\r\n\r\n\treturn $symbol;\r\n}","note":"This snippet can be used to change the separator symbol on pages","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24361,"title":"Change Time zone Offset in the Publish Date of the Sitemap Entries","code":"add_filter( 'aioseo_sitemap_rss', 'aioseo_filter_rss_sitemap_entries' );\r\n\r\nfunction aioseo_filter_rss_sitemap_entries( $entries ) {\r\n\t$entries = array_map( function ( $entry ) {\r\n\t\tif ( empty( $entry['pubDate'] ) ) {\r\n\t\t\treturn $entry;\r\n\t\t}\r\n\r\n\t\t$dateTime = new DateTime();\r\n\r\n\t\t$dateTime->setTimestamp( strtotime( $entry['pubDate'] ) );\r\n\t\t$dateTime->setTimezone( new DateTimeZone( 'Europe\/Moscow' ) );\r\n\r\n\t\t$entry['pubDate'] = date_format( $dateTime, 'D, d M Y H:i:s O' );\r\n\r\n\t\treturn $entry;\r\n\t}, $entries );\r\n\r\n\treturn $entries;\r\n}","note":"The code snippet below can be used to change the time zone offset in the...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24365,"title":"Change Twitter Title for a Specific Post","code":"add_filter( 'aioseo_twitter_tags', 'aioseo_filter_twitter_title' );\r\n\r\nfunction aioseo_filter_twitter_title( $twitterMeta ) {\r\n   if ( is_singular() && '14' === get_the_ID() ) {\r\n      $twitterMeta['twitter:title'] = \"A different title\";\r\n   }\r\n   return $twitterMeta;\r\n}","note":"This filter can be used to Change the Twitter Title for a Specific Post. You...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":25100,"title":"Control Whether AIOSEO Flushes Output Buffer After Rewriting Title","code":"add_filter( 'aioseo_flush_output_buffer', '__return_false' );","note":"This snippet can be used to control whether AIOSEO flushes the output buffer after rewriting...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24154,"title":"Disable AIOSEO Admin Menu Bar","code":"add_filter( 'aioseo_show_in_admin_bar', 'aioseo_disable_admin_bar' );\r\n\r\nfunction aioseo_disable_admin_bar( $enabled ) {\r\n   return false;\r\n}","note":"This filter can be used to Disable AIOSEO Admin Menu Bar.","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":21908,"title":"Disable AIOSEO Schema markups for a specific page","code":"add_filter( 'aioseo_schema_disable', 'aioseo_disable_schema_for_specific_page' );\r\n\r\nfunction aioseo_disable_schema_for_specific_page( $disabled ) {\r\n   if ( is_page( 1209 ) ) {\r\n      return true;\r\n   }\r\n   return $disabled;\r\n}","note":"This snippet removes the AIOSEO Schema Markups from a specific page. Note: Replace '1209' with...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24094,"title":"Disable All Page Builder Integration","code":"add_filter( 'aioseo_page_builder_integration_disable', '__return_true' );","note":"This filter can be used to completely disable our page builder integration for all builders.","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":2343,"title":"Disable autogenerated shipping details schema for WooCommerce","code":"add_filter( 'aioseo_schema_woocommerce_shipping_disable', '__return_true' );","note":"This code snippet will disable AIOSEO autogenerated shipping details schema for WooCommerce Products","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24002,"title":"Disable Custom Link Format of AIOSEO in the Block and Classic Editors","code":"add_filter( 'aioseo_disable_link_format', '__return_true' );","note":"This snippet can be used to disable the custom link format that All in One...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":25209,"title":"Disable Emoji Image Conversion Script of the Classic Editor","code":"add_filter( 'aioseo_classic_editor_disable_emoji_script', '__return_true' );","note":"This filter can be used to disable the emoji image conversion script of the Classic...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":[],"max_version":""},{"library_id":29245,"title":"Disable OpenGraph Tags on all Listing Detail Pages","code":"add_filter( 'aioseo_facebook_tags', 'aioseo_filter_remove_facebook_tags' );\r\nfunction aioseo_filter_remove_facebook_tags( $facebookMeta ) {\r\n    $uri = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH );\r\n    if ( strpos( $uri, '\/listing-detail\/' ) !== false ) {\r\n        return array();\r\n    }\r\n    return $facebookMeta;\r\n}","note":"This snippet disables OpenGraph Tags on all pages whose URL contains \/listing-detail\/","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24097,"title":"Disable Redirect Logging in AIOSEO Redirects","code":"add_filter( 'aioseo_redirects_log_skip', 'redirects_log_skip', 10, 2 );\r\nfunction redirects_log_skip( $skip, $data ) {\r\n\tif ( 404 === $data['http_code'] ) {\r\n\t\t$skip = true;\r\n\t}\r\n\r\n\treturn $skip;\r\n}","note":"This filter can be used to skip logging redirect logging in AIOSEO Redirects.","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24152,"title":"Disable Schema Output for WooCommerce products","code":"add_filter( 'aioseo_schema_disable', 'aioseo_disable_schema_products' );\r\n\r\nfunction aioseo_disable_schema_products( $disabled ) {\r\n   if ( is_singular( 'product' ) && aioseo()->helpers->isWooCommerceActive() ) {\r\n      return true;\r\n   }\r\n   return $disabled;\r\n}","note":"This filter can be used to Disable Schema Output for WooCommerce products.","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24155,"title":"Disable SEO News Dashboard Widget","code":"add_filter( 'aioseo_show_seo_news', 'aioseo_disable_dashboard_widget' );\r\n\r\nfunction aioseo_disable_dashboard_widget( $enabled ) {\r\n   return false;\r\n}","note":"This filter can be used to Disable SEO News Dashboard Widget.","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":2110,"title":"Disable SEO Preview feature","code":"add_action( 'init', function() {\r\n\tif ( ! function_exists( 'aioseo' ) ) {\r\n\t\treturn;\r\n\t}\r\n    remove_action( 'wp', [ aioseo()->standalone->seoPreview, 'init' ] );\r\n}, 100);","note":"This code snippet can be used to remove the \"SEO Preview\" feature in All in...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":1994,"title":"Disable Shortcode Parsing in All in One SEO","code":"add_filter( 'aioseo_disable_shortcode_parsing', '__return_true' );","note":"This filter can be used to prevent AIOSEO from parsing shortcodes.","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":25101,"title":"Disable the AIOSEO Flyout Menu for Non-Administrator Users.","code":"add_filter( 'aioseo_flyout_menu_enable', 'aioseo_filter_flyout_menu_enable' );\r\nfunction aioseo_filter_flyout_menu_enable( $enabled ) {\r\n\tif ( ! aioseo()->access->isAdmin() ) {\r\n\t\t$enabled = false;\r\n\t}\r\n\r\n\treturn $enabled;\r\n}","note":"This snippet can be used to disable the AIOSEO flyout menu for non-administrator users.","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24499,"title":"Disable the Last Updated Date in Index\/Root XML Sitemap","code":"add_filter( 'aioseo_sitemap_lastmod_disable', '__return_true' );","note":"This filter can be used to disable the Last Updated date that All in One...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24153,"title":"Dynamically Add Article Schema to Posts","code":"add_filter( 'aioseo_schema_graphs', 'aioseo_filter_schema_graphs' );\r\n\r\nfunction aioseo_filter_schema_graphs( $graphs ) {\r\n   if ( is_singular( 'post' ) && ! in_array( 'Article', $graphs, true ) ) {\r\n      $graphs[] = 'Article';\r\n   }\r\n   return $graphs;\r\n}","note":"This filter can be used to Dynamically Add Article Schema to Posts.","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":25108,"title":"Dynamically Change the SEO Title of a Specific Post Before the Metadata is Saved","code":"add_filter( \"aioseo_save_post\", \"aioseo_filter_post_data\" );\r\n\r\nfunction aioseo_filter_post_data( $post ) {\r\n\tif ( 10 === (int) $post->post_id ) {\r\n\t\t$post->title = 'Some new title here';\r\n\t}\r\n\treturn $post;\r\n}","note":"The code snippet below can be used to dynamically change the SEO title of a...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24006,"title":"Dynamically Change the SEO title of a Specific Post when the Metadata is Loaded","code":"add_filter( \"aioseo_get_post\", \"aioseo_filter_post_data\" );\r\n\r\nfunction aioseo_filter_post_data( $post ) {\r\n\tif ( 10 === (int) $post->post_id ) {\r\n\t\t$post->title = 'Some new title here';\r\n\t}\r\n\treturn $post;\r\n}","note":"This filter can be used to dynamically change the SEO title of a specific post...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":25111,"title":"Dynamically Change the SEO Title of a Specific Term Before the Metadata is Saved","code":"add_filter( \"aioseo_save_term\", \"aioseo_filter_term_data\" );\r\n\r\nfunction aioseo_filter_term_data( $term ) {\r\n\tif ( 12 === (int) $term->term_id ) {\r\n\t\t$term->title = 'Some new title here';\r\n\t}\r\n\treturn $term;\r\n}","note":"The code snippet below can be used to dynamically change the SEO title of a...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24008,"title":"Dynamically Change the SEO title of a Specific Term when the Metadata is Loaded","code":"add_filter( \"aioseo_get_term\", \"aioseo_filter_term_data\" );\r\n\r\nfunction aioseo_filter_term_data( $term ) {\r\n\tif ( 12 === (int) $term->term_id ) {\r\n\t\t$term->title = 'Some new title here';\r\n\t}\r\n\treturn $term;\r\n}","note":"This filter can be used to dynamically change the SEO title of a specific term...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":1893,"title":"Enable WooCommerce Product Attributes in Search Appearance","code":"add_filter( 'aioseo_woocommerce_product_attributes', '__return_true' );","note":"By default, AIOSEO does not include support for WooCommerce Product Attributes in our Search Appearance...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24157,"title":"Exclude a Specific Post from the Sitemap","code":"add_filter( 'aioseo_sitemap_exclude_posts', 'aioseo_sitemap_filter_excluded_posts', 10, 2 );\r\n\r\nfunction aioseo_sitemap_filter_excluded_posts( $ids, $type ) {\r\n   if ( 'general' === $type ) {\r\n      $ids[] = 614;\r\n   }\r\n   return $ids;\r\n}","note":"This filter can be used to Exclude a Specific Post from the Sitemap. Note: Replace...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24158,"title":"Exclude a Specific Term from the Sitemap","code":"add_filter( 'aioseo_sitemap_exclude_terms', 'aioseo_sitemap_filter_excluded_terms', 10, 2 );\r\n\r\nfunction aioseo_sitemap_filter_excluded_terms( $ids, $type ) {\r\n   if ( 'general' === $type ) {\r\n      $ids[] = 412;\r\n   }\r\n   return $ids;\r\n}","note":"This filter can be used to Exclude a Specific Term from the Sitemap. Note: Replace...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":26138,"title":"Exclude All Posts of a Category from News Sitemap","code":"add_filter( 'aioseo_sitemap_exclude_posts', 'aioseo_sitemap_filter_excluded_posts', 10, 2 );\r\n\r\nfunction aioseo_sitemap_filter_excluded_posts( $ids, $type ) {\r\n    if ( 'news' === $type ) {\r\n        $category_id = 136; \r\n        \r\n        $posts_in_category = get_posts(array(\r\n            'category' => $category_id,\r\n            'numberposts' => -1,\r\n            'fields' => 'ids'\r\n        ));\r\n        \r\n        $ids = array_merge($ids, $posts_in_category);\r\n    }\r\n    return $ids;\r\n}","note":"This snippet can be used to exclude All Posts of a Category from News Sitemap....","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":29166,"title":"Fix Image Caption Rendering Issue Caused by WPResidence Theme","code":"if(!function_exists('wp_get_attachment') ) :\r\n    function wp_get_attachment( $attachment_id )\r\n    {\r\n        $attachment = get_post($attachment_id);\r\n\r\n        if( $attachment ) {\r\n            $caption = function_exists('aioseoImageSeo') \r\n                ? aioseoImageSeo()->tags->replaceTags(aioseo()->options->image->caption->format, $attachment->ID, 'caption') \r\n                : $attachment->post_excerpt;\r\n\r\n            return array(\r\n                'alt' => get_post_meta($attachment->ID, '_wp_attachment_image_alt', true),\r\n                'caption' => $caption,\r\n                'description' => $attachment->post_content,\r\n                'href' =>  esc_url(get_permalink($attachment->ID)),\r\n                'src' => $attachment->guid,\r\n                'title' => $attachment->post_title\r\n            );\r\n        } else {\r\n            return array(\r\n                    'alt' => '',\r\n                    'caption' => '',\r\n                    'description' => '',\r\n                    'href' => '',\r\n                    'src' => '',\r\n                    'title' => ''\r\n            );\r\n        }\r\n    }\r\nendif;","note":"This snippet fixes the Image Caption Rendering Issue Caused by WPResidence Theme","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":2276,"title":"Fix LearnPress conflict that hides AIOSEO tabs on settings pages","code":"add_filter( 'learnpress\/admin\/can-load-assets\/lp-admin', 'aioseoDontLoadLearnPress', 10, 2 );\r\nadd_filter( 'learnpress\/admin\/can-load-assets\/lp-admin-notice', 'aioseoDontLoadLearnPress', 10, 2 );\r\nfunction aioseoDontLoadLearnPress( $canLoad, $currentPage ) {\r\n\tif ( false === strpos( $currentPage, 'aioseo' ) ) {\r\n\t\treturn $canLoad;\r\n\t}\r\n\r\n\treturn false;\r\n}","note":"LearnPress hides the tabs of AIOSEO by loading its Vue assets on our pages. This...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24010,"title":"Hide AlOSEO version number from the front end","code":"add_filter( 'aioseo_hide_version_number', '__return_true' );","note":"This filter can be used to publicly hide the All in One SEO version number.","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24367,"title":"Hide Author SEO Tab From User Profile Page","code":"add_filter( \"aioseo_user_profile_tab_disable\", \"__return_true\" );","note":"This filter can be used to Hide Author SEO Tab From User Profile Page","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24080,"title":"Hide Business Info Phone Number from the Front End","code":"add_filter( 'aioseo_local_business_output_business_info_instance', 'aioseo_change_local_business_output_business_info_instance', 10, 3 );\r\n\r\nfunction aioseo_change_local_business_output_business_info_instance( $instance, $postId, $locationData ) {\r\n\t$instance['showPhone'] = false;\r\n\r\n\treturn $instance;\r\n}","note":"This filter can be used to hide business info phone number from the front end.","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24085,"title":"Hide Specific Day From Opening Hours Output","code":"add_filter( 'aioseo_local_business_output_opening_hours_instance', 'aioseo_change_local_business_output_opening_hours_instance', 10, 3 );\r\n\r\nfunction aioseo_change_local_business_output_opening_hours_instance( $instance, $postId, $openingHoursData ) {\r\n\t$instance['showSunday'] = false;\r\n\r\n\treturn $instance;\r\n}","note":"This filter can be used to hide a specific day from Opening Hours output Replace...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":23993,"title":"Hide the breadcrumbs on pages.","code":"add_filter( 'aioseo_breadcrumbs_output', 'aioseo_breadcrumbs_output' );\r\nfunction aioseo_breadcrumbs_output( $display ) {\r\n\tif ( is_singular( 'page' ) ) {\r\n\t\t$display = false;\r\n\t}\r\n\r\n\treturn $display;\r\n}","note":"This snippet can be used to hide the breadcrumbs on pages.","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":23996,"title":"Hide the last item in the breadcrumb trail","code":"add_filter( 'aioseo_breadcrumbs_show_current_item', 'aioseo_breadcrumbs_show_current_item', 10, 3 );\r\nfunction aioseo_breadcrumbs_show_current_item( $showCurrentItem, $type, $reference ) {\r\n\tif ( is_singular( 'page' ) ) {\r\n\t\t$showCurrentItem = false;\r\n\t}\r\n\r\n\treturn $showCurrentItem;\r\n}","note":"This filter can be used to hide the last item in the breadcrumb trail.","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24500,"title":"Ignore Cover Image Block when \u201cFirst Image in Content\u201d is set as the Image Source","code":"add_filter( 'aioseo_social_image_ignore_cover_block', '__return_true' );","note":"This filter can be used to ignore the cover image block when \u201cFirst Image in...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24011,"title":"Increase the Number of Posts Imported Per Batch from Rank Math Plugin","code":"add_filter( 'aioseo_import_rank_math_posts_per_action', 'aioseo_increase_rank_math_posts_import');\r\nfunction aioseo_increase_rank_math_posts_import( $number ) {\r\n\treturn 250;\r\n}","note":"This filter can be used to increase the default number of posts imported per batch...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24012,"title":"Increase the Number of Posts Imported Per Batch from SEOPress Plugin","code":"add_filter( 'aioseo_import_seopress_posts_per_action', 'aioseo_increase_seopress_posts_import');\r\nfunction aioseo_increase_seopress_posts_import( $number ) {\r\n\treturn 250;\r\n}","note":"This filter can be used to increase the default number of posts imported per batch...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24013,"title":"Increase the Number of Posts Imported Per Batch from Yoast SEO Plugin","code":"add_filter( 'aioseo_import_yoast_seo_posts_per_action', 'aioseo_increase_yoast_posts_import');\r\nfunction aioseo_increase_yoast_posts_import( $number ) {\r\n\treturn 250;\r\n}","note":"This filter can be used to increase the default number of posts imported per batch...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":2366,"title":"Limit Meta Description to 160 characters","code":"add_filter( 'aioseo_description', 'aioseo_filter_description' );\r\nfunction aioseo_filter_description( $description ) {\r\n   if ( strlen($description) > 160 ) {\r\n      $description = substr($description, 0, 159);\r\n   }\r\n   return $description;\r\n}","note":"This filter limits the Meta Description to 160 characters throughout the website","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":2365,"title":"Limit SEO Title to 60 characters","code":"add_filter( 'aioseo_title', 'aioseo_filter_title' );\r\nfunction aioseo_filter_title( $title ) {\r\n   if ( strlen($title) > 60 ) {\r\n      $title = substr($title, 0, 60);\r\n   }\r\n   return $title;\r\n}","note":"This filter limits the SEO Title length to 60 characters throughout the website","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":1995,"title":"Noindex Product Search Pages","code":"add_filter( 'aioseo_robots_meta', 'aioseo_filter_robots_meta' );\r\nfunction aioseo_filter_robots_meta( $attributes ) {\r\n\tif ( is_search() && 'product' === get_query_var('post_type') ) {\r\n\t\t$attributes['index'] = \"noindex\";\r\n\t};\r\n\treturn $attributes;\r\n}","note":"This code snippet can be used to set noindex on WooCommerce product search pages.","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":2134,"title":"Noindex Products under a Product Category","code":"add_filter( 'aioseo_robots_meta', 'aioseo_filter_robots_meta' );\r\n\r\nfunction aioseo_filter_robots_meta( $attributes ) {\r\n\tif ( has_term( 'CategoryName', 'product_cat' ) ) {\r\n\t\t$attributes['noindex']  = 'noindex';\r\n\t}\r\n\treturn $attributes;\r\n}","note":"This code snippet can be used to set noindex on all the Products under a...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24748,"title":"Output og:image that uses the Large Size Image","code":"add_filter( 'aioseo_thumbnail_size', function( $imageSize ) {\r\n    return 'large';\r\n} );","note":"This snippet can be used to output og:image that uses the large size image","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":25106,"title":"Prevent AIOSEO From Outputting a rel=\u201dnext\u201d Link","code":"add_filter( 'aioseo_next_link', 'aioseo_filter_next_link' );\r\n\r\nfunction aioseo_filter_next_link( $next ) {\r\n   return '';\r\n}","note":"Prevent AIOSEO from outputting a rel=\u201dnext\u201d link","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":25107,"title":"Prevent AIOSEO From Outputting a rel=\u201dprev\u201d Link","code":"add_filter( 'aioseo_prev_link', 'aioseo_filter_prev_link' );\r\n\r\nfunction aioseo_filter_prev_link( $previous ) {\r\n   return '';\r\n}","note":"Prevent AIOSEO from outputting a rel=\u201dprev\u201d link","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":25105,"title":"Prevent AIOSEO From Outputting any Data on Category Archive Pages","code":"add_filter( 'aioseo_meta_views', 'aioseo_filter_meta_views' );\r\n\r\nfunction aioseo_filter_meta_views( $views ) {\r\n   if ( is_category() ) {\r\n      return [];\r\n   }\r\n   return $views;\r\n}","note":"Prevent AIOSEO from outputting any data on category archive pages.","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24001,"title":"Prevent AlOSEO from outputting any data on term pages","code":"add_filter( 'aioseo_disable', 'aioseo_disable_term_output' );\r\n\r\nfunction aioseo_disable_term_output( $disabled ) {\r\n   if ( is_category() || is_tag() || is_tax() ) {\r\n      return true;\r\n   }\r\n   return false;\r\n}","note":"This snippet can be used to prevent AlOSEO from outputting any data on term pages","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":23999,"title":"Prevent Canonical URL tag output on Posts","code":"add_filter( 'aioseo_canonical_url', 'aioseo_filter_canonical_url' );\r\n\r\nfunction aioseo_filter_canonical_url( $url ) {\r\n   if ( is_singular() ) {\r\n      return '';\r\n   }\r\n   return $url;\r\n}","note":"This snippet can be used to prevent AIOSEO from outputting the Canonical URL tag on...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":2344,"title":"Recreate the aioseo_cache table","code":"add_action( 'init', function() {\r\n\tif ( function_exists( 'aioseo' ) ) {\r\n\t\taioseo()->preUpdates->createCacheTable();\r\n\t}\r\n});","note":"This code snippet recreates the missing 'aioseo_cache' table. This code snippet should be enabled and...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":15591,"title":"Remove #listItem from Breadcrumb schema","code":"add_filter('aioseo_schema_output', 'aioseo_schema_remove_list_item');\r\n\r\n\/\/ Callback function to remove '#listItem' from URLs in BreadcrumbList\r\nfunction aioseo_schema_remove_list_item($graphs) {\r\n    \/\/ Loop through each element in the array\r\n    foreach ($graphs as $index => $value) {\r\n        \/\/ Check if the key '@type' is set and its value is 'BreadcrumbList'\r\n        if (isset($value['@type']) && $value['@type'] === 'BreadcrumbList') {\r\n            \/\/ Call the recursive function to remove '#listItem' from BreadcrumbList\r\n            $graphs[$index] = aioseo_recursive_remove_list_item($value);\r\n        }\r\n    }\r\n\r\n    return $graphs;\r\n}\r\n\r\n\/\/ Recursive function to traverse the array and remove '#listItem'\r\nfunction aioseo_recursive_remove_list_item($array) {\r\n    \/\/ Loop through each element in the array\r\n    foreach ($array as $key => &$value) {\r\n        \/\/ If the element is an array, recursively call the function\r\n        if (is_array($value)) {\r\n            $value = aioseo_recursive_remove_list_item($value);\r\n        }\r\n        \/\/ If the element is a string and contains '#listItem', remove it\r\n        elseif (is_string($value) && strpos($value, '#listItem') !== false) {\r\n            $value = rtrim($value, '#listItem');\r\n        }\r\n    }\r\n\r\n    return $array;\r\n}","note":"This snippet removes #listItem from all the URLs in the Breadcrumb schema","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24015,"title":"Remove Address Line 2 from the Local SEO address output on the front end","code":"function aioseo_change_local_business_address_tags( $tags ) {\t\t\r\n\tforeach ( $tags as $key => $tag ) {\r\n\t\tif ( 'streetLineTwo' === $tag['id'] ) {\r\n\t\t\tunset( $tags[ $key ] );\r\n\t\t}\r\n\t}\r\n\treturn $tags;\r\n}\r\n\r\nadd_filter( 'aioseo_local_business_address_tags', 'aioseo_change_local_business_address_tags' );","note":"This filter can be used to remove Address Line 2 from the Local SEO address...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":5807,"title":"Remove AggregateRating and Reviews Schema","code":"add_filter( 'aioseo_schema_output', 'product_schema_aggregate_reviews' );\r\nfunction product_schema_aggregate_reviews( $schema ) {\r\n\tforeach ( $schema as &$schemaItem ) {\r\n\t\tif ( 'Product' === $schemaItem['@type'] ) {\r\n\t\t\tunset ($schemaItem['aggregateRating']);\r\n\t\t\tunset ($schemaItem['review']);\r\n\t\t}\r\n\t}\r\n\r\n\treturn $schema;\r\n}","note":"This filter code removes the AggregateRating and Reviews Schemas","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24005,"title":"Remove article:published_time and article:modified_time meta tags from all posts","code":"add_filter( 'aioseo_facebook_tags', 'aioseo_filter_facebook_article_tags' );\r\n\r\nfunction aioseo_filter_facebook_article_tags( $facebookMeta ) {\r\n   if ( is_singular() ) {\r\n      $facebookMeta['article:published_time'] = '';\r\n      $facebookMeta['article:modified_time']  = '';\r\n   }\r\n   return $facebookMeta;\r\n}","note":"This filter can be used to remove article:published_time and article:modified_time meta tags from all posts","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":17801,"title":"Remove Author Schema entirely from the website","code":"add_filter( 'aioseo_schema_output', 'add_author_name_when_missing' );\r\nfunction add_author_name_when_missing( $schema ) {\t\r\n\tforeach ( $schema as &$schemaItem ) {\r\n\t\tif ( isset($schemaItem['author']) ) {\r\n\t\t\tunset($schemaItem['author']);\r\n\t\t}\r\n\t}\r\n\treturn $schema;\r\n}","note":"This snippet removes Author Schema entirely from the website","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24713,"title":"Remove BreadcrumbList Schema","code":"add_filter( 'aioseo_schema_output', 'aioseo_filter_schema_output' );\r\n\r\nfunction aioseo_filter_schema_output( $graphs ) {\r\n    foreach ( $graphs as $index => $graph ) {\r\n\t\tif ( 'BreadcrumbList' === $graph['@type'] ) {\r\n\t\t\tunset( $graphs[ $index ] );\r\n\t\t}\r\n\r\n\t\tforeach ( $graph as $key => $value ) {\r\n\t\t\tif ( 'breadcrumb' === $key ) {\r\n\t\t\t\tunset( $graphs[ $index ][ $key ] );\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn $graphs;\r\n}","note":"This snippet removes the BreadcrumbList Schema","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24495,"title":"Remove Customer Role From Excluded Roles","code":"add_filter( 'aioseo_access_control_excluded_roles', 'aioseo_filter_access_control_excluded_roles' );\r\nfunction aioseo_filter_access_control_excluded_roles( $roles ) {\r\n\tif ( ( $key = array_search( 'customer', $roles ) ) !== false ) {\r\n\t\tunset( $roles[ $key ] );\r\n\t}\r\n\treturn $roles;\r\n}","note":"This filter can be used to remove the customer role from the excluded roles","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24715,"title":"Remove datePublished and dateModified properties from the Article schema for Posts","code":"add_filter( 'aioseo_schema_output', 'aioseo_filter_schema_output' );\r\n\r\nfunction aioseo_filter_schema_output( $schema ) {\r\n\tforeach ( $schema as $index => $graphData ) {\r\n\t\tif ( empty( $graphData['@type'] ) ) {\r\n\t\t\tcontinue;\r\n\t\t}\r\n\r\n\t\t$type = strtolower( $graphData['@type'] );\r\n\t\tswitch ( $type ) {\r\n\t\t\tcase 'article':\r\n\t\t\tcase 'blogposting':\r\n\t\t\tcase 'newsarticle':\r\n\t\t\t\tunset( $schema[ $index ]['datePublished'] );\r\n\t\t\t\tunset( $schema[ $index ]['dateModified'] );\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\treturn $schema;\r\n}","note":"This snippet removes the datePublished and dateModified properties from the Article schema for Posts","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":3513,"title":"Remove SEO Statistics from the Dashboard menu","code":"add_action( 'admin_menu', 'aioseo_hide_search_stats_menu', 99999 );\r\n\r\nfunction aioseo_hide_search_stats_menu() {\r\n\tglobal $submenu;\r\n\tif ( ! isset( $submenu['index.php'] ) ) {\r\n\t\treturn;\r\n\t}\r\n\r\n\tforeach ( $submenu['index.php'] as $index => $props ) {\r\n\t\tif ( ! empty( $props[2] ) && admin_url( '\/admin.php?page=aioseo-search-statistics' ) === $props[2] ) {\r\n\t\t\tunset( $submenu['index.php'][ $index ] );\r\n\t\t\treturn;\r\n\t\t}\r\n\t}\r\n}","note":"Code Snippet to remove SEO Statistics from the Dashboard menu","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24095,"title":"Remove Specific Post Type From Public Post Type List","code":"add_filter( 'aioseo_public_post_types', 'aioseo_filter_public_post_types' );\r\n\r\nfunction aioseo_filter_public_post_types( $postTypes ) {\r\n  $filteredPostTypes = [];\r\n  foreach ( $postTypes as $postTypeObject ) {\r\n    if ( is_array( $postTypeObject ) && 'movie' === $postTypeObject['name'] ) {\r\n      continue;\r\n    }\r\n    $filteredPostTypes[] = $postTypeObject;\r\n  }\r\n  return $filteredPostTypes;\r\n}","note":"This filter can be used to remove the movie post type from the public post...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24096,"title":"Remove Specific Taxonomy From Public Taxonomies List","code":"add_filter( 'aioseo_public_taxonomies', 'aioseo_filter_public_taxonomies' );\r\nfunction aioseo_filter_public_taxonomies( $taxonomies ) {\r\n\t$filteredTaxonomies = [];\r\n\tforeach ( $taxonomies as $taxonomiesObject ) {\r\n\t\tif ( 'genre' === $taxonomiesObject['name'] ) {\r\n\t\t\tcontinue;\r\n\t\t}\r\n\t\t$filteredTaxonomies[] = $taxonomiesObject;\r\n\t}\r\n\r\n\treturn $filteredTaxonomies;\r\n}","note":"This filter can be used to remove the 'genre' taxonomy from the public taxonomies list.","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24714,"title":"Remove the Article schema from Posts","code":"add_filter( 'aioseo_schema_output', 'aioseo_filter_schema_output' );\r\n\r\nfunction aioseo_filter_schema_output( $graphs ) {\r\n\tif ( is_singular( 'post' ) ) {\r\n \t   foreach ( $graphs as $index => $graph ) {\r\n\t\t\tif ( 'Article' === $graph['@type'] ) {\r\n\t\t\t\tunset( $graphs[ $index ] );\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn $graphs;\r\n}","note":"This snippet removes the Article schema from Posts","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24716,"title":"Remove the author of an article","code":"add_filter( 'aioseo_schema_output', 'aioseo_filter_schema_output' );\r\n\r\nfunction aioseo_filter_schema_output( $graphs ) {\r\n\tif ( is_singular( 'post' ) ) {\r\n \t   foreach ( $graphs as $index => $graph ) {\r\n\t\t\tif ( 'Article' === $graph['@type'] ) {\r\n\t\t\t\tunset( $graphs[ $index ]['author'] );\r\n\t\t\t}\r\n\r\n\t\t\tif ( 'Person' === $graph['@type'] ) {\r\n\t\t\t\tunset( $graphs[ $index ] );\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn $graphs;\r\n}","note":"This snippet removes author of an article","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":2008,"title":"Remove the Canonical URL for a specific URL","code":"add_filter( 'aioseo_canonical_url', 'aioseo_filter_canonical_url' );\r\nfunction aioseo_filter_canonical_url( $url ) {\r\n\tif (strpos($url,'\/properties\/') !== false) {\r\n\t\t$url = home_url( $_SERVER['REQUEST_URI'] );\r\n\t}\r\n\treturn $url;\r\n}","note":"This code snippet can be used to remove the canonical URL for a specific URL...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":23998,"title":"Remove the crumb for the \u2018uncategorized\u2019 category","code":"add_filter( 'aioseo_breadcrumbs_trail', 'aioseo_breadcrumbs_trail' );\r\nfunction aioseo_breadcrumbs_trail( $crumbs ) {\r\n\tforeach ( $crumbs as $key => $crumb ) {\r\n\t\tif ( is_a( $crumb['reference'], 'WP_Term' ) && 'uncategorized' === $crumb['reference']->slug ) {\r\n\t\t\tunset( $crumbs[ $key ] );\r\n\t\t}\r\n\t}\r\n\r\n\treturn $crumbs;\r\n}","note":"This snippet can be used to remove the crumb for the \u2018uncategorized\u2019 category","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":23992,"title":"Remove the link from the current breadcrumb item on a page","code":"add_filter( 'aioseo_breadcrumbs_link_current_item', 'aioseo_breadcrumbs_link_current_item', 10 );\r\nfunction aioseo_breadcrumbs_link_current_item( $linkCurrentItem ) {\r\n\tif ( is_singular( 'page' ) ) {\r\n\t\t$linkCurrentItem = false;\r\n\t}\r\n\r\n\treturn $linkCurrentItem;\r\n}","note":"This snippet removes the link from the current breadcrumb item on a page.","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":2834,"title":"Scan images from Elementor Galleries and counts them for the sitemap XML","code":"add_filter(\r\n\t'aioseo_sitemap_images',\r\n\t\/**\r\n\t * Find new images inside the post content which has Elementor galleries.\r\n\t * It only works for self-hosted attachments.\r\n\t *\r\n\t * @param  array  $images The images already found.\r\n\t * @param  object $post   The post object\r\n\t * @return array          All images merged with found images.\r\n\t *\/\r\n\tfunction ( $images, $post ) {\r\n\t\tif (\r\n\t\t\t! is_array( $images ) ||\r\n\t\t\t! is_object( $post ) ||\r\n\t\t\tempty( $post->ID ) ||\r\n\t\t\tempty( $post->post_content )\r\n\t\t) {\r\n\t\t\treturn $images;\r\n\t\t}\r\n\r\n\t\t\/\/ Bail if this post is not being edited under Elementor.\r\n\t\tif ( 'builder' !== get_post_meta( $post->ID, '_elementor_edit_mode', true ) ) {\r\n\t\t\treturn $images;\r\n\t\t}\r\n\r\n\t\tpreg_match_all( '\/<a.+?href=\"(http[^\"]+)\"\\s.+?lightbox.*?>\/i', $post->post_content, $matches );\r\n\r\n\t\tif ( empty( $matches[1] ) ) {\r\n\t\t\treturn $images;\r\n\t\t}\r\n\r\n\t\tforeach ( $matches[1] as $url ) {\r\n\t\t\t$url = wp_get_attachment_url( attachment_url_to_postid( $url ) );\r\n\t\t\tif ( $url ) {\r\n\t\t\t\t$images[] = $url;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn array_unique( $images );\r\n\t},\r\n\t10,\r\n\t2\r\n);","note":"This snippet will find new images inside the post content, which has Elementor Galleries. And...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24497,"title":"Set AIOSEO Metabox Priority to Low","code":"add_filter( 'aioseo_post_metabox_priority', 'aioseo_filter_metabox_priority' );\r\n\r\nfunction aioseo_filter_metabox_priority( $priority) {\r\n   return 'low';\r\n}","note":"Set the AIOSEO metabox priority to low","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":2382,"title":"Set current URL as the Canonical URL and ignore query strings","code":"add_filter( 'aioseo_canonical_url', 'aioseo_filter_canonical_url' );\r\nfunction aioseo_filter_canonical_url( $url ) {\r\n\tif (strpos($_SERVER['REQUEST_URI'],'\/home-search\/listing\/') !== false) {\r\n\t\t$url = home_url( $_SERVER['REQUEST_URI'] );\r\n\t\tif (strpos($url,'?') !== false){\r\n\t\t\t\t$url = substr( $url, 0, strpos($url,'?') );\r\n\t\t}\r\n\t}\r\n\treturn $url;\r\n}","note":"This snippet searches for a specific string in the current URL and if found, it...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":17514,"title":"Set max-video-preview to 0","code":"add_filter( 'aioseo_robots_meta', 'aioseo_filter_robots_meta' );\r\n\r\nfunction aioseo_filter_robots_meta( $attributes ) {\r\n   $attributes['max-video-preview']  = 'max-video-preview: 0';\r\n   return $attributes;\r\n}","note":"This snippet sets max-video-preview robots meta tag to 0","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":16393,"title":"Shortcode to get all taxonomy values of current post","code":"function display_post_artists_shortcode() {\r\n    \/\/ Get the terms (artists) of the \"artist\" taxonomy for the current post\r\n    $artists = get_the_terms(get_the_ID(), 'artist');\r\n\r\n    \/\/ Check if artists exist\r\n    if ($artists && !is_wp_error($artists)) {\r\n        \/\/ Start building the output\r\n        $output = [];\r\n\r\n        \/\/ Loop through each artist\r\n        foreach ($artists as $artist) {\r\n            \/\/ Generate a link to the artist archive\r\n            $artist_link = get_term_link($artist);\r\n\r\n            \/\/ Append each artist to the output\r\n            $output[] = esc_html($artist->name);\r\n        }\r\n\t\t\r\n\t\t\/\/ Merge the artist names with a comma separator\r\n\t\t$output = implode(', ', $output);\r\n\r\n        return $output;\r\n    }\r\n\r\n    \/\/ Return an empty string if no artists are found\r\n    return '';\r\n}\r\n\r\n\/\/ Register the shortcode\r\nadd_shortcode('post_artists', 'display_post_artists_shortcode');\r\n","note":"This snippet declares a shortcode to get all \"Artist\" taxonomy values of the current post.","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":17652,"title":"Show link assistant suggestions","code":"add_action('admin_head', 'show_link_assistant_suggestions');\r\n\r\nfunction show_link_assistant_suggestions() {\r\n  echo '<style>\r\n    .aioseo-tab-content.aioseo-link-assistant .wp-table .wp-list-table.widefat.fixed{\r\n\t  position: unset !important;\r\n    } \r\n  <\/style>';\r\n}","note":"This snippet fixes a conflict of a custom theme with the default WordPress class called...","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":13911,"title":"Showcase IDX plugin - Replace all Permalink URLs with current URL in Schema","code":"add_filter( 'aioseo_schema_output', 'aioseo_schema_change_urls' );\r\nfunction aioseo_schema_change_urls( $graphs ) {\r\n    if ( false === strpos( $_SERVER['REQUEST_URI'], 'search-results\/listing\/' ) ) {\r\n        return $graphs;\r\n    }\r\n\t\r\n    $request_uri = explode( '?', $_SERVER['REQUEST_URI'] );\r\n\t$request_uri = explode( '#', $request_uri[0] );\r\n    $url_parts = trim($request_uri[0], '\/');\r\n    $url_parts = explode('\/', $url_parts);\r\n    $last_segment = end($url_parts);\r\n    $old_url = get_permalink();\r\n    $new_url     = home_url( $request_uri[0] );\t\r\n\t\r\n    foreach ( $graphs as $index => &$value ) {\r\n        if ( is_array( $value ) ) {\r\n            $value = aioseo_schema_change_urls( $value );\r\n        }\r\n\r\n        if ( is_string( $value ) ) {\r\n            if ( $value === $old_url ) {\r\n                $value = $new_url;\r\n            } elseif ( false !== strpos( $value, $old_url . '#' ) ) {\r\n                $value = str_replace( $old_url, $new_url, $value );\r\n            }\r\n        }\r\n\t\t\r\n    }\r\n\r\n    return $graphs;\r\n}","note":"This snippet replaces all the Permalink URLs with the current URL in Schema markup.","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""},{"library_id":24498,"title":"Unminify Schema Output in Source Code","code":"add_filter( 'aioseo_schema_json_flags', function() {\r\n\treturn JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE;\r\n} );","note":"This filter can be used to unminify schema output in the source code.","categories":["aioseo"],"code_type":"php","needs_auth":false,"tags":["aioseo"],"max_version":""}]}
Site is undergoing maintenance

PACJA Events

Maintenance mode is on

Site will be available soon. Thank you for your patience!