Problems with search links

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Problems with search links

This topic contains 1 reply, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 2 years, 11 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #28325
    Bertnick69
    Bertnick69
    Participant

    With the new function of this plugin (WP RSS FEED) you can import feeds and create new posts on the WordPress site. In this way the search must go through the wordpress article and inside it will have the link to the official site where the feed was taken. This way I can customize the Feed page before the user ends up on another site. Unfortunately, however, when the user searches through your plugin, even if the article has been imported and created in WordPress when you search the site and click on the link, the user is continually sent to the Feed site and not to the internal page.

    How can I solve this problem?

    To do the research tests you should use the Ajax module present in the internal pages and not in HomePage (https://papertel.eu/gruppi/)

    This is a link to an article imported with WP RSS FEED and for which a WordPress Article has been created
    ( https://papertel.eu/2020/07/06/promesse-mancate-rimborsi-fantasma-e-scandali-cosi-i-brand-si-giocano-la-fiducia/ )

    If you search for the words ‘promesse mancate’ and click on the link that as a result you are sent to the external link to the site and not to the wordpress article.

    Thank you

    Attachments:
    You must be logged in to view attached files.
    #28333
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    Thanks for the details, it helps a lot! You have the following custom code in your theme functions.php:

    add_filter( 'asp_results', 'asp_custom_link_meta_results', 10, 1 );
    function asp_custom_link_meta_results( $results ) {
        // Change this variable to whatever meta key you are using
        $key = 'wprss_item_permalink';
    
        // Parse through each result item
        foreach ($results as $k=>$v) {
            if ( function_exists('get_field') )
                $new_url = get_field( $key, $v->id, true ); // ACF support
            else
                $new_url = get_post_meta( $v->id, $key, true );
    
            // Change only, if the meta is specified
            if ( !empty($new_url) ) {
                $results[$k]->link = $new_url;
            }
        }
    
        return $results;
    }

    This modifies the search results link to the wprss_item_permalink custom field value. Removing the custom code will resolve the issue.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


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

You must be logged in to reply to this topic.