Add warning to edit slug/permalink button on editor screen.

WordPress has already hooked jQuery events to that button which you could omit with off() method, or keep things simple and add an overlay above that button and act as the button, prompting users to confirm the editing action at first place: jQuery(document).ready(function($){ var c = $(‘#edit-slug-buttons’) , b = $(‘button’,c).first(); c.css({ position: ‘relative’ }).append(‘<span … Read more

How to Remove Slug From Database?

I don’t exactly know about the word embed, but by default WordPress reserves & uses these sort of words for internal use. I tried to create a page slug named embed but it wouldn’t work for me either on my localhost or on my live server. Maybe this is reserved for WordPress oEmbed functionality.

How to control which category will be picked for the slug of a post?

WordPress picks the lowest ID as its main permalink. However, ALL categories will contain your post automatically. Meaning both these: http://yoursite/category-A/post-A http://yoursite/category-B/post-A …will return your post (given that post-A is in both category-A and category-B) via a redirect. It can’t list them all to you on the Edit page, sorry. But it will make sure … Read more

How to achieve this permalink -> category-name/custom-post-type-name/post-name

You have to filter ‘post_type_link’ to create the appropriate permalink. See this answer for a similar example. The following code works: add_action( ‘init’, array ( ‘WPSE_63343’, ‘init’ ) ); class WPSE_63343 { protected $post_type=”video”; public static function init() { new self; } public function __construct() { $args = array ( ‘public’ => TRUE, ‘rewrite’ => … Read more

Get attachment by slug

An attachment is just a post with the post_status = inherit and the post_type = attachment, so can be queried with WP_Query or get_posts. Note that slug (post_name) is unique per post type. $_header = get_posts(‘post_type=attachment&name=book-site-header&posts_per_page=1&post_status=inherit’); $header = $_header ? array_pop($_header) : null; $header_url = $header ? wp_get_attachment_url($header->ID) : ”; you can also use the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)