: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
namespace Yoast\WP\SEO\Services\Health_Check;
* Presents a set of different messages for the Links_Table health check.
class Links_Table_Reports {
* Shortlinker object used to create short links for reports.
* @param Report_Builder_Factory $report_builder_factory The factory for result builder objects.
* This class uses the report builder to generate WordPress-friendly
* @param WPSEO_Shortlinker $shortlinker Object used to add short links to the report description.
public function __construct(
Report_Builder_Factory $report_builder_factory,
WPSEO_Shortlinker $shortlinker
$this->report_builder_factory = $report_builder_factory;
$this->shortlinker = $shortlinker;
* Returns the message for a successful health check.
* @return string[] The message as a WordPress site status report.
public function get_success_result() {
return $this->get_report_builder()
->set_label( \__( 'The text link counter is working as expected', 'wordpress-seo' ) )
->set_description( $this->get_success_description() )
* Returns the message for a failed health check.
* @return string[] The message as a WordPress site status report.
public function get_links_table_not_accessible_result() {
return $this->get_report_builder()
->set_label( \__( 'The text link counter feature is not working as expected', 'wordpress-seo' ) )
->set_status_recommended()
->set_description( $this->get_links_table_not_accessible_description() )
->set_actions( $this->get_actions() )
* Returns the description for when the health check was successful.
* @return string The description as a string.
private function get_success_description() {
/* translators: 1: Link to the Yoast SEO blog, 2: Link closing tag. */
\esc_html__( 'The text link counter helps you improve your site structure. %1$sFind out how the text link counter can enhance your SEO%2$s.', 'wordpress-seo' ),
'<a href="' . $this->shortlinker->get( 'https://yoa.st/3zw' ) . '" target="_blank">',
WPSEO_Admin_Utils::get_new_tab_message() . '</a>'
* Returns the description for when the health couldn't access the links table.
* @return string The description as a string.
private function get_links_table_not_accessible_description() {
/* translators: 1: Yoast SEO. */
\__( 'For this feature to work, %1$s needs to create a table in your database. We were unable to create this table automatically.', 'wordpress-seo' ),
* Returns the actions that the user should take when the links table is not accessible.
* @return string The actions as a string.
private function get_actions() {
/* translators: 1: Link to the Yoast help center, 2: Link closing tag. */
\esc_html__( '%1$sFind out how to solve this problem on our help center%2$s.', 'wordpress-seo' ),
'<a href="' . $this->shortlinker->get( 'https://yoa.st/3zv' ) . '" target="_blank">',
WPSEO_Admin_Utils::get_new_tab_message() . '</a>'