Admin_UI::prevent_slug_changes( array $post_data, array $submitted_data )

Summary

Prevent updates to the post slug


Parameters

$post_data

(array) (Required)

$submitted_data

(array) (Required)


Return

(array)


Source

File: src/BigCommerce/Post_Types/Product/Admin_UI.php

	public function prevent_slug_changes( $post_data, $submitted_data ) {
		if ( empty( $submitted_data[ 'ID' ] ) || empty( $post_data[ 'post_type' ] ) || $post_data[ 'post_type' ] !== Product::NAME ) {
			return $post_data;
		}

		$original_slug            = wp_slash( get_post_field( 'post_name', $submitted_data[ 'ID' ] ) );
		$post_data[ 'post_name' ] = $original_slug;

		return $post_data;
	}

User Contributed Notes

You must log in before being able to contribute a note or feedback.