Filter-Hook Request
-
Hi mate,
I am facing an issue regarding different custom post types in different blogs. Here is my stackoverflow question regarding the issue itself: https://stackoverflow.com/questions/64753068/how-to-correctly-determine-whether-a-post-type-is-active-in-a-given-blog-in-a-wo?noredirect=1#comment114489656_64753068
Now, as it doesn’t seem to be possible to safely determine whether post-types are active in other blogs, I was wondering if you could add an option for us developers to filter the hreflang output, so we can check whether a tag should be printed or not depending on our own setup.
Specifically, a filter in
MslsOutput.phpin methodget_alternate_linkswould we great. Maybe just after$url = $blog->get_url($options);in the foreach loop, something like:$url = apply_filters('mlsl_output_url', $url, $blog);And – or maybe event better – also in the
MslsBlog::get_permalink($options)method as the blog id is actually set to the respective blog there, just after$url = $options->get_permalink($this->get_language());
also add a filter so you can return null for the URL if desired$url = apply_filters('mlsl_blog_permalink', $url, $this, $this->obj->userblog_id);Then we can simply return null if I don’t want a specific hreflang tag to be printed. At the current point, we only can
remove_action('wp_head', ['lloc\Msls\MslsPlugin', 'print_alternate_links']);But this will avoid any tags from being printed, also the x-default.
If there is another way you would approach this issue feel free to point it out.
Thanks for your support!
Markus.- This topic was modified 5 years, 5 months ago by .
- This topic was modified 5 years, 5 months ago by .
- This topic was modified 5 years, 5 months ago by .
- This topic was modified 5 years, 5 months ago by .
- This topic was modified 5 years, 5 months ago by .
- This topic was modified 5 years, 5 months ago by .
The topic ‘Filter-Hook Request’ is closed to new replies.