WordPress.org

Ready to get started?Download WordPress

Forums

Automaticly replace text in new posts, is it possible? (2 posts)

  1. jeriksson
    Member
    Posted 3 years ago #

    Hello,

    Some of my sites are using other sites that generate code which has text in them that we don't like, like alt="" tags etc. I would like to know if there's someway to use javascript to check each post before they are posted and if "target string" is found it replaces that text with whatever we set it to.

    I found a plugin called "Search % Replace" and it worked great, however this would mean we have to manually run this a lot, and as the database grows the load on checking all posts will be larger, so a script that did this once each post would be better.

    Anyone have any ideas, or want a job for some money?

  2. gameblogs
    Member
    Posted 3 years ago #

    How do you get the content from the other sites? I do something similar with the FeedWordpress plugin.

    For the replacing, it will depend on if you want to alter the content permanently on the DB or just when showing it.

    If you are ok with just changing on showing the page, the Real Time Search and Replace plugin can help. If not, you will need to set up a hook to run every time a new post is published, altering the post in the DB.

Topic Closed

This topic has been closed to new replies.

About this Topic