Created
December 12, 2016 12:31
-
-
Save rayrutjes/494ba3acffdba7cb1da0c23c6f45236b to your computer and use it in GitHub Desktop.
This gist is useful for the Algolia plugin for WordPress when the backend URL is different from the frontend URL.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * @param array $shared_attributes | |
| * | |
| * @return array | |
| */ | |
| function custom_post_shared_attributes( array $shared_attributes) { | |
| $shared_attributes['permalink'] = str_replace( 'cms.', 'www.', $shared_attributes['permalink'] ); | |
| return $shared_attributes; | |
| } | |
| add_filter( 'algolia_post_shared_attributes', 'custom_post_shared_attributes' ); | |
| add_filter( 'algolia_searchable_post_shared_attributes', 'custom_post_shared_attributes' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment