• Can someone get me started on the following – maybe pointing me in the direction of a similar type of example that I can start with.

    What I want to do is, at the time I save a post (before it actually gets into the database) is:

    Read the content of the post and find any occurence of [title New Post Title] and save and remove it.

    I then want to use New Post Title as the post title.

    For example, the content of the post might be:

    “[title Dummy Post]
    <p>This is a dummy post.</p>”

    The result should be a post with title “Dummy Post” and content “<p>This is a dummy post.</p>”

    I have written a couple of simple plugins (just for myself) before but they’ve been based on going through the content when a post is displayed, not saved.

Viewing 1 replies (of 1 total)
  • Thread Starter nickathome

    (@nickathome)

    Any ideas, anyone?

    I’ve spent hours hunting around for stuff and suspect that what I need to use is a content_save_pre filter.

    Also a wp_insert_post_data filter looks like it might be useful, but does that only work when you insert a post? I want something that will also work for updates.

    But I haven’t made much progress beyond that and can’t find documentation in the codex that helps.

    Does anyone have an example I can work from, or point me in the direction of an existing plugin that makes use of something similar so I can try to work out how it works?

    Thanks.

Viewing 1 replies (of 1 total)
  • The topic ‘Help wanted with plugin that changes content etc when post saved’ is closed to new replies.