• Resolved ntellisense

    (@ntellisense)


    Is there a filter to allows us to associate specific attachment with a specific post? Relevanssi indexes PDF attachments and associated those attachments by looking at the post parent. But, does this method still work if the PDF was not added to the post using the editor, and was added using Advanced Custom Fields? ACF stores the ID of the post. If there was a hook where we can associate attachments to a post using the attachment ID, that would be a solution.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You could, for example, add a relevanssi_indexing_data filter hook that checks the PDF post ID from the ACF field, then adds the PDF data like relevanssi_index_pdf_for_parent() function does.

    If you need more help with this, send a support request from the Relevanssi support page.

    Thread Starter ntellisense

    (@ntellisense)

    Thanks, I was able to loop through all ACF custom fields and repeaters to find fields that were of the “file” type. Then, I checked if there was any index data for the file (meta_key: _relevanssi_pdf_content), and when there was, I added that data as additional post data using the relevanssi_indexing_data filter. I reused some of the code in the relevanssi_index_pdf_for_parent function to accomplish this.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Indexing PDFs attached through Advanced Custom Fields – Relevanssi’ is closed to new replies.