• Resolved playbasfa

    (@playbasfa)


    Hello, if i set the “New Post Status” to Pending Review and then I approve, everything is working great!

    But if the “New Post Status” is set to “Published” is not working properly, meaning that the url created is wrong, specifically
    https://www.mywebsite.com/myCPT_slug/interested_item

    instead of

    https://www.mywebsite.com/something/something_else/interested_item

    If I access the interested_item (just created from my client in the front-end tks to your plugin) from the backend and I click on update, then everything is working great because I’ve a setting on Permalink manager with that change the URL

    from
    https://www.mywebsite.com/myCPT_slug/interested_item

    to this
    https://www.mywebsite.com/something/something_else/interested_item

    automatically, every time a CPT is created or updated.
    The problem is that seems that this automatic change doesn’t work if the interested_item is created through your form.

    Any idea on how to fix this?

    I know this is more a problem of integration with Permalink manager but since the customer that use your plugin are kind of “advanced customer”, is really likely that these same people will have the need of using Permalink manager as I do so I think is a problem that is worth it investigating.

    Thank you,
    Fabrizio

    • This topic was modified 5 years, 2 months ago by playbasfa.
    • This topic was modified 5 years, 2 months ago by playbasfa.
Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Shabti Kaplan

    (@shabti)

    You are right, Permalink manager intergration is important.

    I think the best and quickest way to solve this issue is for me to add an option to add a special url to redirect with variables. Would that be okay?

    Thread Starter playbasfa

    (@playbasfa)

    In my opinion, but I’m not a developer, the thing is that permalink manager already manage perfectly the change of the of the permalink itself for any kind of permalink and everything is already setup in the permalink setting.

    If I create a post from the wordpress back-end as you can see from the picture here “the current URI” is empty and when I publish the post the default setting is gonna take over.

    But when I create the custom post type with your plugin, somehow automatically the current URI is https://www.mywebsite.com/myCPT_slug/interested_item so I have to enter from the backend in order to make permalink start working.

    Maybe permalink has an hook that you can use when submitting the post?

    Plugin Author Shabti Kaplan

    (@shabti)

    We do have a hook to change the form settings, but be warned: test on a staging site first. I’ll add it below

    I must look at what I can do about this integration… If its something very simple, I’ll be happy to add to the free version. In the mean time I’ll add more options for the redirect link.

    (Warning! Don’t use on live site unless you know what you are doing. Even then be careful)

    add_filter( 'acfef/form_args', function( $form_args, $settings ){
      $post_url = $form_args[ 'return' ];
    //change the url format which some php magic.
    
    }, 10, 2 );

    Assuming you set “redirect url” to new post this will return the “‘%post_url%’” which ACF uses to generate the new url.

    I don’t know what you can do from here yet, but you can reference the ACF support
    forum. Maybe someone can help you turn this into what you are looking for.

    Thread Starter playbasfa

    (@playbasfa)

    Thank you so much but unfortunately is breaking something, I meana that as soon as I save the filter then the widget is not present anymore not inside Elementor not in the live page.
    As soon as I remove the filter and refresh the pages, the widget is visible again both inside Elementor both in the live page.

    Thank you,
    Fabrizio

    Plugin Author Shabti Kaplan

    (@shabti)

    Oh yes I forgot to add in the most important part, returning the form arguments

    add_filter( 'acfef/form_args', function( $form_args, $settings ){
      $post_url = $form_args[ 'return' ];
    //change the url format which some php magic.
    
    return $form_args; //this is critical.
    }, 10, 2 );

    Sorry about. haha. that’s why you need to use a staging site

    Thread Starter playbasfa

    (@playbasfa)

    Wow this is working great! Thank you so so much!

    Plugin Author Shabti Kaplan

    (@shabti)

    My pleasure! Did you find help on the ACF support forum?

    Thread Starter playbasfa

    (@playbasfa)

    Not really, I just used your filter and it worked right away

    Plugin Author Shabti Kaplan

    (@shabti)

    glad to hear

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Problem on URI when publishing right away’ is closed to new replies.