Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed hook type #15342

Closed
2 tasks done
georgejipa opened this issue May 30, 2020 · 7 comments
Closed
2 tasks done

Changed hook type #15342

georgejipa opened this issue May 30, 2020 · 7 comments

Comments

@georgejipa
Copy link

  • I've read and understood the contribution guidelines.
  • I've searched for any related issues and avoided creating a duplicate issue.

Please give us a description of what happened.

In older versions of the plugin, wpseo_add_opengraph_images and wpseo_add_opengraph_additional_images were actions.

Version: 13.2:

		/**
		 * Filter: wpseo_add_opengraph_images - Allow developers to add images to the OpenGraph tags.
		 *
		 * @api WPSEO_OpenGraph_Image The current object.
		 */
		do_action( 'wpseo_add_opengraph_images', $this );

		/**
		 * Filter: wpseo_add_opengraph_additional_images - Allows to add additional images to the OpenGraph tags.
		 *
		 * @api WPSEO_OpenGraph_Image The current object.
		 */
		do_action( 'wpseo_add_opengraph_additional_images', $this );

Version 14.2:

			/**
			 * Filter: wpseo_add_opengraph_images - Allow developers to add images to the Open Graph tags.
			 *
			 * @api Yoast\WP\SEO\Values\Open_Graph\Images The current object.
			 */
			\apply_filters( 'wpseo_add_opengraph_images', $image_container );

			/**
			 * Filter: wpseo_add_opengraph_additional_images - Allows to add additional images to the Open Graph tags.
			 *
			 * @api Yoast\WP\SEO\Values\Open_Graph\Images The current object.
			 */
			\apply_filters( 'wpseo_add_opengraph_additional_images', $image_container );

Used versions

  • Yoast SEO version: 14.2
@Djennez
Copy link
Member

Djennez commented Jun 3, 2020

Additional info: this was changed in 14.0-RC3.

@georgejipa were you running code that was using these 2 hooks? Custom code or a plugin?

@georgejipa
Copy link
Author

@Djennez yes. custom plugin for a customer.

@Djennez
Copy link
Member

Djennez commented Jun 5, 2020

I've discussed this internally. It's true that this change was not documented and communicated. For that we must apologize. Though we also see that this hook was already used a lot as a filter, so we're not seeing / expecting a lot of problems.

It wasn't an error to change the hook type though, so the filter type is here to stay. The best option moving forward is adapting your code.

As this is a change that is here to stay, I'm closing this thread. Again, apologies for the undocumented change. If you have any additional questions / remarks, please feel free to leave a reply.

@Djennez Djennez closed this as completed Jun 5, 2020
@georgejipa
Copy link
Author

georgejipa commented Jun 5, 2020

I already changed my code. Thanks.

@pocketcolin
Copy link

@georgejipa are you also planning to add the same filters for Twitter?

@georgejipa
Copy link
Author

@pocketcolin There is a filter called wpseo_frontend_presenter_classes. I've used it to replace the default image presenters (Yoast\WP\SEO\Presenters\Open_Graph\Image_Presenter, Yoast\WP\SEO\Presenters\Twitter\Image_Presenter) with my custom presenters, and now I have full control over what is displayed.

@pocketcolin
Copy link

Ahh good idea I'll look into that. And sorry I meant to tag @Djennez ! Obviously, you won't be adding filters to the Yoast core.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants