Forums

Urgent!! get the future permalink of a pending post (3 posts)

  1. thewor
    Member
    Posted 4 months ago #

    I use wordpress as cms, I have a script that insert a pending post using wp_insert_post function. And I need the future permalink of the post to my scripts do their job while the post still pending and hide form bots and visitors.
    How can I do that? Using the get_permalink function wordpress returns the default permalink (?p=) and not my custom permalink.
    Thank you for your attention!!!

  2. Shane G
    Member
    Posted 4 months ago #

    Hi,

    Set your desired permalinks structure..and add this code in htaccess:

    # BEGIN WordPress

    <IfModule mod_rewrite.c>
    ErrorDocument 404 /index.php?error=404
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    # END WordPress

    After that check with old and new post..

    Thanks,

    Shane G.

  3. thewor
    Member
    Posted 4 months ago #

    Thank you Shane G but you not understand the problem, the permalinks work well and are configured the problem is when I insert a draft post using the "wp insert post" can not know the custom permalink and even after the publication using "wp publish post" the post appears as published in the database but does not appear on the site.
    I need know the custom permalink of a draft post using some function!!
    And need resolve the problem of the post not appear in the site even after the publication using "wp publish post" function.
    Thank you!!!

Reply

You must log in to post.

About this Topic

Tags