Forums

Creating a post when it does not exist (8 posts)

  1. wesleyb77425
    Member
    Posted 8 months ago #

    Hi chaps,

    I have setup wordpress to retrieve posts using the %post_name% PERMLINK, I would now like to create a plugin that will create a post when it does not exist. For example,

    - user requests http://domain.com/does-not-exist
    - on the back end, I create an empty post titled 'does-not-exist' which is then returned to the user.

    I'm pretty new to wordpress, and although I understand how actions/filters work, I can't see an elegant solution to this.

    If you have any ideas how I could do this quickly and efficiently, please share.

    wes

  2. doodlebee
    Member
    Posted 8 months ago #

    I'm sorry - but what would be the purpose of this? What you're describing would mean that post would be created any time someone tried to visit a non-existent URL on your site. It doesn't make any sense. Why would you want to do that?

  3. wesleyb77425
    Member
    Posted 8 months ago #

    Yes, that's exactly what I am describing, any pointers to help me out?

  4. vachi
    Member
    Posted 8 months ago #

    its a pretty cool idea, idk how you can do this but i suggest trying to save the link that the user requested that did not exist, so save the 404s
    and when they request a page thats a 404 just say we are creating this page at the moment ( in your 404 template ) than you can see the 404s and just make those pages

  5. doodlebee
    Member
    Posted 8 months ago #

    I'm still not sure what the purpose is - nor if it's even possible. You have to be logged in (and have the capability level) to create a post. What you're suggesting is that *anyone* could come along and create a post, just by typing in some random URL that starts with your domain name. The possibilities of exploitation are mid-boggling.

    Maybe if you explained *why* you want this done, an alternative (and possibly better) solution could be offered.

  6. wesleyb77425
    Member
    Posted 8 months ago #

    A pity, I was hoping to avoid switching on legacy hacks.

  7. doodlebee
    Member
    Posted 8 months ago #

    So, you don't want to share what the purpose is for, in hopes of a better suggestion? Well, good luck with that then.

  8. selfmade64856
    Member
    Posted 8 months ago #

    - wesleyb77425 -
    Fantastic idea! I see exactly where you're going with that. If you find the solution let me know and I'll do the same ;)

    Ciao

Reply

You must log in to post.

About this Topic