Home Forums General Issues Options page and custom slug


Options page and custom slug

  • Hello,

    I have multiple instances using acf + options page and i have created x fields for each custom post type slug.
    I wan to create a plugin so i can import acf + give the admin the option to change it on each instance.
    I will also include the ACF groups + fields exports in the plugin also.

    My code looks something like this:

    function change_slug( $args, $post_type ) {
       if ( 'post_type_1' === $post_type ) {
       		$post_type1 = the_field('solutions_slug');
          $args['rewrite']['slug'] = $post_type1;
       if ( 'post_type_2' === $post_type ) {
          $args['rewrite']['slug'] = 'new_slug_2';
       return $args;
    add_filter( 'register_post_type_args', 'change_slug', 10, 2 );

    Any input is appreciated.

    Thank You

Viewing 1 post (of 1 total)

The topic ‘Options page and custom slug’ is closed to new replies.