Wordpress Permalink for Advanced Custom Fields

I’m working on customizing a Wordpress search page using the Algolia Search Plugin. Everything has been going great except that I can’t seem to figure out how to get a permalink for a custom post type saved to the wp_searchable_posts index.

All my custom post types are saving to Algolia just fine, search is great. But when I try to tap on a result in search results, the URL is blank, because it looks like it is looking for the permalink field. I’ve tried pushing a permalink field, but it only adds to the custom post type index, not to wp_searchable_posts.

I’m sure I’m doing something simple incorrectly. Thanks!

1 Like

The permalink should be pushed to Algolia automatically if you’re using the Wordpress plugin. Can you see the permalink in wp_searchable_posts within the Algolia Indices area?

Thanks for the response @jack. Only core WP post types like posts, pages, etc. have the permalink in wp_searchable_posts. My custom post types do not send a permalink over. Which is why I’m confused and certain I’m doing something wrong in my setup.

k_c

By default, Custom Post Types should sync automatically too, but there are reasons why they won’t. Posts need to be published, and the excluded_from_search setting on your custom post type needs to be set to false. After making any changes, you’ll need to reindex the search from your Wordpress admin.

Ok I’ll dig into it some more, but the custom post types are available inside wp_searchable_posts. But none of the custom post types actually includes the permalink field. Everything else is in there but that. I’ll keep looking, but really weird. Thanks for your help!

UPDATE: Its working now. The issue was entirely my own. I had manipulated some of the fields before indexing on Algolia and failed to include permalink in the new array. I appreciate the help!

No problem, glad you got it working.