• Resolved Castor

    (@castoruk)


    Hi

    Is it possible to modify the URL in the search results for a custom post type?

    I have a field in the custom post i’d like to use to build a URL instead of the default.

    At the moment it’s outputting in this format:

    http://domain.com/wp-default/?post_type={custom_post_type}&a={id}

    But I want it to output http://domain.com/test/{string from DB field}

    Is this possible, and if so just for a specific custom_post_type?

    I know that this may not be Relevanssi specific but I though there may be a function or hook that could be used.

    Any suggestions would be appreciated.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Mikko Saari

    (@msaari)

    Sure, you can use the_permalink filter hook to modify the permalinks. If you only want this to apply on the search results page, it’s probably easier to just check for the post type on the template, and if it’s the custom post type, print out the link manually instead of using the_permalink().

    Thread Starter Castor

    (@castoruk)

    Thanks for the reply.

    Figured this out using the WP Codex.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Modify links in search results’ is closed to new replies.