Adding future, draft and private posts to the Add Link modal

For anyone who plans out their content, you are likely quite frustrated with the fact that when you use the “Add Link” button in the WordPress editor, you can only search for existing content if it is already published.

This is a royal pain in the arse. If you’re writing a series for example, where you will publish four different but related articles one day after the next, you won’t be able to use the Add Link dialog to link to the other posts until after they’re published which is useless when you’re scheduling content in advance. The workaround to this is to add the link manually, but that’s certainly cumbersome.

I once tried to get this changed in WordPress core and while it didn’t happen, a new filter was added as a result, which enables us to filter the WP_Query used to display posts in the Add Link window.

As such, I built a quick plugin which now changes the Add Link WP_Query by changing the post_status parameter from “publish” to “any”, meaning that your draft posts, scheduled posts, private posts and even posts with custom post statuses (like pitches created by Edit Flow) can now be linked to from the Add Link window.

In a future iteration, I’d like to be able to identify each post’s status (so that you don’t inadvertently link to content that you believe to be publicly accessible), but that doesn’t seem particularly easy at the moment as there aren’t the appropriate filters in the wp_link_dialog() function.

At any rate, the plugin is readily available on GitHub and so that you can create links more freely.

View/follow/download on GitHubDownload from

Leave a Reply