Plugin translation not working apart from name and description

Seems like you forgot to load the text domain The plugin handbook says that: You need to load the MO file with your plugin’s translations. You can load them by calling the function load_plugin_textdomain() (and load_muplugin_textdomain() if your plugin will be used as a Must-Use plugin). This call loads {text-domain}-{locale}.mo from your plugin’s base directory. … Read more

How to retrieve category NAME instead of ID in a function with a taxonomy custom field?

You need to get the term object first. //Your meta field $post_custom_title = get_post_meta($post_id,’car_name’,true); //Get the term object by id. change taxonomy_slug to the taxonomy you intend to use $term = get_term_by( ‘id’, $post_custom_title, ‘taxonomy_slug’ ); //Retrive the term name and use it as post title $term_name = $term->name; //call the wp_update_post function setting $term_name … Read more

Why is my Custom Post Type not showing up after adding capabilities?

You have to register custom capabilities and then apply inside the register post type function function register_website_caps() { $admins = get_role( ‘administrator’ ); $admins->add_cap( ‘edit_website’ ); $admins->add_cap( ‘read_website’ ); $admins->add_cap( ‘delete_website’ ); $admins->add_cap( ‘edit_websites’ ); $admins->add_cap( ‘edit_others_websites’ ); $admins->add_cap( ‘publish_websites’ ); $admins->add_cap( ‘read_private_websites’ ); } add_action( ‘admin_init’, ‘register_website_caps’); // Creating the website post type function … Read more

How much control do we have over CPT rewrite slugs? Can I create a “root” page for my CPT with out the page path, and then have paths for other pages?

The way I see it, you could do: // Via the init hook, do all these: register_post_type( ‘library-books’, [ ‘public’ => true, ‘label’ => ‘Library Books’, ‘rewrite’ => [ ‘with_front’ => false, ‘slug’ => ‘library/books’ ], ‘has_archive’ => ‘library/books’, // other args here ] ); register_post_type( ‘library’, [ ‘public’ => true, ‘label’ => ‘Libraries’, ‘rewrite’ … Read more

Custom Post Type without an archive page

Is this a WordPress feature? Yes, and the redirect is being done by redirect_canonical(), but the URL is determined by redirect_guess_404_permalink(): redirect_guess_404_permalink() Attempts to guess the correct URL for a 404 request based on query vars. So what’s happening in your case is, WordPress attempts to find a post having book in the slug (post_name), … Read more