What I'm trying to achieve is a simple text-replace functions, that would be available to any site in my Wordpress Network. Basically I want to:

  1. Change [--] into — (—),

  2. Be able to link to my own posts using only their titles -- [internallink post=title] or anything similar.

I found simple example of solving this using shortcodes. But I don't know, where to put my custom shortcodes definition, so it would be available to any site in my Wordpress Network.

I'm always looking into solutions as simple as possible, so I would like to know, if I have to use shortcodes to solve these two tasks or:

  1. Is there an easy way to define global search & replace mechanism, so any occurence of just -- would be changed to — in any post or page on any site in the network?

  2. Is there anyway to define global shortcode function, that would convert any [post title] into link poiting to post titled "Post Title"?

Thank you in advance for any help here?

  • 1
    Part of what you are doing is already handled by wptexturize
    – s_ha_dum
    Mar 24, 2013 at 13:46

1 Answer 1


To have a Network enabled shortcode, you only need a Must Use plugin. Just create the folder /wp-content/mu-plugins and drop your code there. From the Codex:

  • Always-on, no need to enable via admin and users cannot disable by accident.
  • Can be enabled simply by uploading file to the mu-plugins directory, without having to log-in.
  • Loaded by PHP, in alphabetical order, before normal plugins, meaning API hooks added in an mu-plugin apply to all other plugins even if they run hooked-functions in the global namespace.

The search and replace issue seems a bit more sensitive and maybe this plugin can be of use: Search and Replace and do it only in the post_content field. You can also use the filter the_content, search this site for various examples on how to deal with it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.