Skip to content

Instantly share code, notes, and snippets.

@rayrutjes
Created December 12, 2016 12:31
Show Gist options
  • Select an option

  • Save rayrutjes/494ba3acffdba7cb1da0c23c6f45236b to your computer and use it in GitHub Desktop.

Select an option

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.
<?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