Javid
Forum Replies Created
-
Hi there ,
I removed my custom function for generate CPT in functions.php file , and then I installed CPTUI plugin , then I create CPT and custom taxonomy with CPTUI , and checked wordpress core tags for my CPT , with using wordpress core tag for CPT now I have article:tag meta in head section , but when I’m using custom tag taxonomy created by CPTUI plugin , I don’t have article:tag meta in head section .
Thank you
Hi there , Im using this function to create my CPT book , and booktag , for custom taxonomy tag :
function CPT_book_func() { ? // Set UI labels for Custom Post Type ? $labels = array( ? ? ? 'name' ? ? ? ? ? ? ? ?=> _x( 'CPT Books', 'Post Type General Name', 'twentytwentyone' ), ? ? ? 'singular_name' ? ? ? => _x( 'Book', 'Post Type Singular Name', 'twentytwentyone' ), ? ? ? 'menu_name' ? ? ? ? ? => __( 'Books', 'twentytwentyone' ), ? ? ? 'parent_item_colon' ? => __( 'Parent Book', 'twentytwentyone' ), ? ? ? 'all_items' ? ? ? ? ? => __( 'All Books', 'twentytwentyone' ), ? ? ? 'view_item' ? ? ? ? ? => __( 'View Book', 'twentytwentyone' ), ? ? ? 'add_new_item' ? ? ? ?=> __( 'Add New Book', 'twentytwentyone' ), ? ? ? 'add_new' ? ? ? ? ? ? => __( 'Add New Book', 'twentytwentyone' ), ? ? ? 'edit_item' ? ? ? ? ? => __( 'Edit Book', 'twentytwentyone' ), ? ? ? 'update_item' ? ? ? ? => __( 'Update Book', 'twentytwentyone' ), ? ? ? 'search_items' ? ? ? ?=> __( 'Search Book', 'twentytwentyone' ), ? ? ? 'not_found' ? ? ? ? ? => __( 'Not Found', 'twentytwentyone' ), ? ? ? 'not_found_in_trash' ?=> __( 'Not found in Trash', 'twentytwentyone' ), ? ); ? // Set other options for Custom Post Type ? $args = array( ? ? 'label' ? ? ? ? ? ? ? => __( 'book', 'twentytwentyone' ), ? ? 'description' ? ? ? ? => __( '', 'twentytwentyone' ), ? ? 'labels' ? ? ? ? ? ? ?=> $labels, ? ? 'supports' ? ? ? ? ? ?=> array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'revisions', 'custom-fields' ), ? ? 'hierarchical' ? ? ? ?=> false, ? ? 'public' ? ? ? ? ? ? ?=> true, ? ? 'show_ui' ? ? ? ? ? ? => true, ? ? 'show_in_menu' ? ? ? ?=> true, ? ? 'show_in_nav_menus' ? => true, ? ? 'show_in_admin_bar' ? => true, ? ? 'menu_position' ? ? ? => 3, ? ? 'can_export' ? ? ? ? ?=> true, ? ? 'has_archive' ? ? ? ? => true, ? ? 'exclude_from_search' => false, ? ? 'publicly_queryable' ?=> true, ? ? 'capability_type' ? ? => 'page', ? ? 'show_in_rest' ? ? ? ?=> true, ? ? 'delete_with_user' ? ?=> true, ? ? 'taxonomies' ? ? ? ? ?=> array( 'booktag', 'category' ), ? ); ? // Registering your Custom Post Type ? register_post_type( 'books', $args ); ? // register booktag taxonomy ? register_taxonomy('booktag','books', array( ? ? 'hierarchical' ?=> false, ? ? 'publicly_queryable ' => true, ? ? 'show_ui' => true, ? ? 'show_in_menu' => true, ? ? 'show_in_nav_menus' => true, ? ? 'show_tagcloud' => true, ? ? 'show_in_rest' ?=> true, ? ? 'label' ? ? ? ? => __( 'Book Tags','taxonomy general name'), ? ? 'singular_name' => __( 'booktag', 'taxonomy general name' ), ? ? 'rewrite' ? ? ? => true, ? ? 'query_var' ? ? => true ? )); ? register_taxonomy_for_object_type('booktag', 'books'); } add_action( 'init', 'CPT_book_func', 0 );
- This reply was modified 1 year, 2 months ago by Javid.
Hi there
add_filter( ‘rank_math/opengraph/facebook/article_tag’, function($tags){ $tags = ‘some tag,another tag’; return $tags; });
I used this filter inside functions.php file , but this filter only works for regular (default) WordPress post type , and Rank math plugin can’t detect my CPT , and when I’m using this filter nothing happen inside CTP page <head></head> section .
Hi there , thank you for your answer .
I can access to $tags inside single.php file for each custom post using custom type post , but how can I access to $tags array?for each post that using custom post type inside functions.php file ?
Thank you
In the option page of this plugin , disable the “Show in Posts” and save it .