• Resolved wmassjunction

    (@wmassjunction)


    When I post using a front end from (ACF Front End to be exact) the permastructure doesn’t apply correctly. Everything is posted as /no-name.

    I’m using an ACF Post Title field to set the title and the slug.

    I realize this could just as much the fault of the form plugin but as I’m waiting to hear back from that dev I thought I would try here as well.

    The structure applies correctly from within the dashboard. Likewise when I deactivate PM the title saves correctly according to the normal WP structure. I also tried another permalink plugin and their structure applied correctly. However, I’m looking to create a very specific structure for some CPTs /customtax_term/title without the CPT name and as far as I can tell only PM will do it.

    I found a similar topic and tried that snippet but it didn’t work. If you have any ideas I would appreciate it.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Maciej Bis

    (@mbis)

    Hi @wmassjunction,

    I apologize for the inconvenience. Could you try to use the below snippet?

    function pm_generate_uri_after_post_saved($post_id, $type, $args, $form, $action) {
        if(class_exists('Permalink_Manager_URI_Functions') && $type == 'insert_post') {
            $custom_uri = Permalink_Manager_URI_Functions_Post::get_default_post_uri($post_id, false, true);
            Permalink_Manager_URI_Functions::save_single_uri($post_id, $custom_uri, false, true);
        }
    }
    add_action('acfe/form/submit/post', 'pm_generate_uri_after_post_saved', 9, 5);

    Best regards,
    Maciej

    Thread Starter wmassjunction

    (@wmassjunction)

    Thanks for your quick response.

    Unfortunately that didn’t work. I tried using the ACF title field as well as adding the title directly. The dev of ACF Front End is looking into it too. I have a feeling the fix will have to be their end. But if you have any other ideas I’d appreciate it.

    Plugin Author Maciej Bis

    (@mbis)

    Hi @wmassjunction,

    Could you ask them to provide any action/filter (used after custom field is saved)? Then, I would be able to update the snippet and make my plugin generate the custom permalink after the custom field data is available.

    Thread Starter wmassjunction

    (@wmassjunction)

    I’ll pass that along and update when I hear back. Thanks.

    Thread Starter wmassjunction

    (@wmassjunction)

    He said it uses ACF/save-post with priority >10

    Hope that helps

    Plugin Author Maciej Bis

    (@mbis)

    Could you try to use the below code instead?

    function pm_generate_uri_after_post_saved($post_id) {
        if(class_exists('Permalink_Manager_URI_Functions')) {
            $custom_uri = Permalink_Manager_URI_Functions_Post::get_default_post_uri($post_id, false, true);
            Permalink_Manager_URI_Functions::save_single_uri($post_id, $custom_uri, false, true);
        }
    }
    add_action('acf/save_post', 'pm_generate_uri_after_post_saved', 20);
    Thread Starter wmassjunction

    (@wmassjunction)

    That worked. Thanks so much for your prompt action.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Permastructure doesn’t apply correctly on front end submission’ is closed to new replies.