Support » Plugin: Broken Link Checker » Full Search of HTML in Custom Fields (with patch!)

  • As many users have reported (#1, #2, #3), Broken Link Checker (BLC) behaves oddly on Custom Fields.

    It seems that the plugin author assumed we would only put in one-line HTML snippets containing a single link (or maybe even plaintext links?). Instead, many of us are putting full HTML inside our custom fields, which is currently broken. Rather than parsing the HTML, BLC only grabs the first line of the custom field. Sometimes BLC was reporting broken links on all of your Custom Fields. Other times, it would check only the first link. The admin panel was not properly showing the links and link text when you looked at the “View Broken Links” page.

    Further, if you used the “Edit URL” link on the admin page, you might not see any result. If you used the “Unlink” capability, it would simply delete that custom field entry!

    Using the html_link parser that Janis already wrote, I have modified the custom_field/metadata parser to support full HTML content. It will check all the links, properly change the URL if you edit from the admin panel and properly unlink from the admin panel.

    This means you’ll also get proper CSS marking of broken links on your custom fields! However, custom fields on other parts of the page (such as header, footer, widgets, etc) are not considered part of “the content”. To mark those links, I have added a ‘blc_mark_broken_links’ filter that your WordPress templates and/or WordPress theme will need to call.

    These patches were written for the latest version as of writing (1.8.2). Please assume that they will break your site if you are using any other version of BLC, although it might not be that serious 😉

    I have tested this on my production site, but no promises for the rest of you. I will do my best to provide answers in the short-term. Hopefully Janis will choose to add these to the official version! Janis, please contact me if they need any further cleanup!!

    To apply these patches:

    • update Broken Link Checker to version 1.8.2
    • apply these patches inside your WordPress plugins directory wp-content/plugins/broken-link-checker/

    Patch Broken Link Checker custom fields

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Full Search of HTML in Custom Fields (with patch!)’ is closed to new replies.