Multiple TinyMCE editors in dynamically generated textareas

The second parameter to wp_editor is the value that the “id” attribute of the textarea element will have, and that is probably why there are such restrictions on it. By default it is also used for the “name” attribute but you can set it explicitly by using the $settings parameter to wp_editor wp_editor($ID, ‘media_desc_n’,array(‘textarea_name’ => … Read more

How to set up a post word limit for a custom post type

Filters and Actions The hooks you can chose to run whatever limits the post content length from, is either save_post, save_post_{post_type} or edit_post (or both) (the following actions are executed inside wp_publish_post() /** This action is documented in wp-includes/post.php */ do_action( ‘edit_post’, $post->ID, $post ); do_action( “save_post_{$post->post_type}”, $post->ID, $post, true ); do_action( ‘save_post’, $post->ID, $post, … Read more

Add meta value to custom post type on publish

You are usgin an undefined $post->ID variable because there is no reference to any $post object in your code; instead, use the $post_ID variable retrieved in the function: function on_jobs_publish( $post_ID ) { global $wpdb; $wpdb->insert( ‘iCrewzWp_postmeta’, array( ‘post_id’ => $post_ID, ‘meta_key’ => ‘_yoast_wpseo_sitemap-include’, ‘meta_value’ => ‘always’ ), array( ‘%d’, ‘%s’, ‘%s’ ) ); } … Read more