SEO Auto Linker
[resolved] Filter for adding keywords/links (6 posts)

  1. bouncesquad
    Posted 4 years ago #

    I suggest adding a filter that allows Links (the keyword/URL/max combinations) to be added dynamically.

    I'm using Yoast's WordPress SEO plugin and I enter a focus keyword for each post, and the keyword is stored by the Yoast plugin. What I'd like to do is have SEO Auto Linker replace each of the focus keywords with the permalink for the article.

    Having a filter like "seoal_links" that we could use to return additional keyword/URL/max combinations in an array would be very useful.

    I plan on hacking something together that does this in a non-pretty way, but having a filter would be useful. Of course a checkbox for Yoast focus keyword integration would be great too.

    Thanks for the useful plugin.


  2. chrisguitarguy
    Plugin Author

    Posted 4 years ago #


    I don't think this is going to work the way you want it to. The "links" in version 0.7+ are just a private custom post type that gets used to store all the data in in {$wpdb->prefix}_postmeta. So, any links you add would have to look like a post object (eg. have the ID attribute) and have post meta to fetch.

    That said, there is a filter that you could hook into and roll your own replacements: https://github.com/AgencyPMG/SEO-Auto-Linker/blob/0.7.1/inc/front.php#L99

    The only thing to watch out for is that there will be anchors to watch out for (eg. <a href="">asdf</a>).

    Option Two:

    Create a dummy keyword. But put at least something in the keywords field. Then use the seoal_link_keywords filter (https://github.com/AgencyPMG/SEO-Auto-Linker/blob/0.7.1/inc/front.php#L185) to replace the actual keywords with whatever you'd like.

    This seems like the easiest option?

    Option Three:

    Since the links you create are just a custom post type, they get fetched with get_posts. You have access to all the filter that come with that (eg. pre_get_posts, posts_where, etc).

  3. bouncesquad
    Posted 4 years ago #

    Thanks for the reply. I'm going to include my hacked together solution below just in case anyone is trying to accomplish the same thing in the future. Although the Links are custom post types, once you get into inc/front.php:content(), only the keywords/URL/max num are required.

    There may be bugs in here somewhere, but the basic structure works and dynamically adds keyword/URL/max combinations. This was made with version 0.7.1 of the plugin.

    Diff to inc/front.php:

    Add to the theme's functions.php:

  4. chrisguitarguy
    Plugin Author

    Posted 4 years ago #

  5. chrisguitarguy
    Plugin Author

    Posted 4 years ago #


    There is now an seoal_links filter in 0.7.2.

    There's some more info here: https://github.com/AgencyPMG/SEO-Auto-Linker/wiki/Filters

  6. bouncesquad
    Posted 4 years ago #

    Great, thanks. I'll check it out.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • SEO Auto Linker
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic