Admin_UI::override_sample_permalink_html( string $html, int $post_id, string $title, string $slug, WP_Post $post )

Summary

Filters the sample permalink HTML markup to make it a static link


Parameters

$html

(string) (Required) Sample permalink HTML markup.

$post_id

(int) (Required) Post ID.

$title

(string) (Required) New sample permalink title.

$slug

(string) (Required) New sample permalink slug.

$post

(WP_Post) (Required) Post object.


Return

(string)


Source

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

	public function override_sample_permalink_html( $html, $post_id, $title, $slug, $post ) {
		if ( get_post_type( $post ) !== Product::NAME ) {
			return $html;
		}

		if ( strpos( $html, 'editable-post-name-full' ) === false ) {
			return $html; // it's not an editable permalink
		}

		$html = preg_replace( '#<span id="editable-post-name">(.*?)</span>#', '$1', $html ); // strip out the editable tags
		$html = preg_replace( '#<span id="edit-slug-buttons">.*?</span>#', '', $html ); // remove the edit button
		$html = preg_replace( '#<span id="editable-post-name-full">.*?</span>#', '', $html ); // remove the hidden field

		return $html;
	}

User Contributed Notes

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