Custom comment status possible?

Quick answer: no. There is not a built-in function to create a new comment status. The status of a comment (or a post/page/attachment/etc) contains wide-spread implications thoughout your WordPress install, so you couldn’t just add one somewhere quickly. I’m not exactly sure what you’re trying to accomplish by adding this new “status”, but I think … Read more

How to set individual capabilities on a taxonomy? Or how to re-register an existing taxonomy?

This should works add_action( ‘init’, ‘register_category_again’, 1 ); function register_category_again() { $user = wp_get_current_user(); if ( $user->roles[0] != ‘your_custom_role’ ) return; global $wp_taxonomies; unset( $wp_taxonomies[‘category’] ); global $wp_rewrite; $rewrite = array( ‘hierarchical’ => true, ‘slug’ => get_option(‘category_base’) ? get_option(‘category_base’) : ‘category’, ‘with_front’ => ! get_option(‘category_base’) || $wp_rewrite->using_index_permalinks(), ‘ep_mask’ => EP_CATEGORIES, ); register_taxonomy( ‘category’, ‘post’, array( … Read more

Order Posts by Taxonomy and Meta Value

In your code, there is if ( isset( $wp_query->query[‘orderby’] ) && $taxonomy == $wp_query->query[‘orderby’] that make your code not work with multiple order fields, because if you set ‘orderby’ => ‘taxonomy_cat meta_value’ then $taxonomy == $wp_query->query[‘orderby’] is never true. In addition, I find that looping all taxonomy only with the aim to find the taxonomy … Read more

Add custom field to media attachment image attribute in post editor

I wonder if you want to modify the HTML of the inserted image, with the image_send_to_editor or get_image_tag filters? If that’s the case, then here’s one example: /** * Add the data-ext-link-title and data-ext-link-url attributes to inserted images. */ add_filter( ‘image_send_to_editor’, function( $html, $id, $caption, $title, $align, $url, $size, $alt ) { if( $id > … Read more

Change page /2 to /transcript with a Rewrite

The rewrite API won’t redirect – it just “maps” URL structures to query strings – you’ll need to do this yourself. First things first, fix that rewrite rule: ‘episode/([^/]+)/transcript’; // Matches anything that follows transcript, not what we want! ‘episode/([^/]+)/transcript/?$’; // Matches only “episode/name/transcript”, optionally with a trailing slash Now bring in a helper function: … Read more

One of two Custom Post types not being registered

An important notice from the Codex: Do pay close attention to not having your custom post type identifier exceed 20 characters though, as the post_type column in the database is currently a VARCHAR field of that length. Please check out: echo strlen( ‘informationtechnology’ ); If you have WP_DEBUG activated, then you will see this warning: … Read more

Restrict taxonomy dropdown to post type

You can use a snippet I found for querying terms that are attached to a particular post type: function wpse_207655_terms_by_post_type_or_meta( $clauses, $taxonomy, $args ) { $meta_query = new WP_Meta_Query; $meta_query->parse_query_vars( $args ); $post_types=””; if ( ! empty( $args[‘post_type’] ) ) { if ( $_post_types = array_intersect( ( array ) $args[‘post_type’], get_post_types() ) ) $post_types = … Read more