Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
consumable
/
wp-content
/
plugins
/
yoast-test-helper
/
src
:
indexing-reason-integration.php
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<?php namespace Yoast\WP\Test_Helper; /** * Adds a filter to change the alert based on the saved set indexing reason. */ class Indexing_Reason_Integration implements Integration { /** * Registers the hook to set the indexing reason. */ public function add_hooks() { \add_filter( 'wpseo_indexables_indexation_alert', [ $this, 'set_indexing_alert' ], 10, 2 ); } /** * Sets the indexing alert to something more specific when the reason is an indexables reset. * * @param string $alert The current content of alert. * @param string $reason The reason to show the alert for. * * @return string The reason to show. */ public function set_indexing_alert( $alert, $reason ) { if ( $reason !== 'indexables-reset-by-test-helper' ) { return $alert; } return \sprintf( /* translators: %1$s: Yoast Test Helper */ \esc_html__( 'Because some of your SEO data was reset by the %1$s, your SEO data needs to be reprocessed.', 'yoast-test-helper' ), 'Yoast Test Helper' ); } }