I have a Custom Type Post: Activities
and two Taxonomies: Levels and Subjects
When I go to
Languages -> “Custom post types and Taxonomies” -> Settings
and decide to translate Taxonomies but not Activities, no post is showed in any of the taxonomies landing page
Activities’ “Activate languages and translations for custom post types.” unchecked
Subjects’ “Activate languages and translations for custom taxonomies.” checked
I double-checked that I actually have contents in a taxonomy. When this taxonomy is enabled for translations stop showing the post list.
]]>i have a custom post type “follow_ups”
heres my args
$follow_up_args = array(
'label' => __( 'Follow up', 'lng' ),
'description' => __( '', 'lng' ),
'labels' => $follow_up_labels,
'menu_icon' => 'dashicons-image-rotate',
'supports' => array('custom-fields'),
'taxonomies' => array(),
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
'show_in_admin_bar' => true,
'show_in_nav_menus' => false,
'can_export' => false,
'has_archive' => false,
'hierarchical' => false,
'exclude_from_search' => true,
'show_in_rest' => false,
'publicly_queryable' => false,
'capability_type' => array('follow_up', 'follow_ups'),
'capabilities' => array(
'edit_post' => 'edit_follow_up',
'read_post' => 'read_follow_up',
'delete_post' => 'delete_follow_up',
'edit_posts' => 'edit_follow_ups',
'edit_others_posts' => 'edit_others_follow_ups',
'publish_posts' => 'publish_follow_ups',
'read_private_posts' => 'read_private_follow_ups',
'delete_posts' => 'delete_follow_ups',
'delete_others_posts' => 'delete_others_follow_ups',
)
);
than i have the map_meta_cap filter like that
function md_map_meta_cap( $caps, $cap, $user_id, $args ) {
/* If editing, deleting, or reading a place, get the post and post type object. */
if ( 'edit_follow_up' == $cap || 'delete_follow_up' == $cap || 'read_follow_up' == $cap ) {
$post = get_post( $args[0] );
$post_type = get_post_type_object( $post->post_type );
/* Set an empty array for the caps. */
$caps = array();
}
if ( 'edit_follow_up' == $cap ) { // If editing a place, assign the required capability.
if ( $user_id == $post->post_author ){
$caps[] = $post_type->cap->edit_posts;
} else {
$caps[] = $post_type->cap->edit_others_posts;
}
} elseif ( 'delete_follow_up' == $cap ) { // If deleting a place, assign the required capability.
if ( $user_id == $post->post_author ){
$caps[] = $post_type->cap->delete_posts;
} else {
$caps[] = $post_type->cap->delete_others_posts;
}
} elseif ( 'read_follow_up' == $cap ) { // If reading a private place, assign the required capability.
if ( 'private' != $post->post_status ){
$caps[] = 'read';
} else if ( $user_id == $post->post_author ){
$caps[] = 'read';
} else {
$caps[] = $post_type->cap->read_private_posts;
}
}
/* Return the capabilities required by the user. */
return $caps;
}
add_filter( 'map_meta_cap', 'md_map_meta_cap', 10, 4 );
now when a custom user role that has the below caps assign to him
1) publish_follow_ups
2) edit_follow_ups
3) edit_others_follow_ups
on custom post type update gets a “you do not have the permission to edit this post”
i tried to debug with “admin_page_access_denied” filter like that
function debug_page_access() {
global $pagenow;
global $menu;
global $submenu;
global $_wp_menu_nopriv;
global $_wp_submenu_nopriv;
global $plugin_page;
global $_registered_pages;
$parent = get_admin_page_parent();
$hookname = get_plugin_page_hookname($plugin_page, $parent);
echo "Pagenow = " . $pagenow . "<br/>";
echo "Parent = " . $parent . "<br/>";
echo "Hookname = " . $hookname . "<br/>";
echo "Submenu = " . $submenu[$parent] . "<br/>";
echo '_wp_menu_nopriv:<br>';
print('<pre>'.print_r($_wp_menu_nopriv,true).'</pre>');
echo "Submenu nopriv = " . $_wp_submenu_nopriv[$parent][$plugin_page] . "<br/>";
echo "Plugin page = " . $plugin_page . "<br/>";
echo "Registered pages = " . $_registered_pages[$hookname] . "<br/>";
}
add_action('admin_page_access_denied', 'debug_page_access');
and this is the output… the edit.php in _wp_menu_nopriv array. any idea? thanks
Pagenow = edit.php
Parent =
Hookname = admin_page_
Submenu =
_wp_menu_nopriv:
Array
(
[upload.php] => 1
[link-manager.php] => 1
[edit.php] => 1
[edit.php?post_type=page] => 1
[edit.php?post_type=blocks] => 1
[themes.php] => 1
[plugins.php] => 1
[tools.php] => 1
[options-general.php] => 1
[aam] => 1
[formcraft-dashboard] => 1
)
Submenu nopriv =
Plugin page =
Registered pages =
]]>Is it compatible with custom post types? Or only with pages and posts?
]]>What am I missing and how can I give in the TAGS for a CPT?
Thanks,
David Belgium
However, the new CPT is showing in the dashboard’s top “+ New” menu items. I can add new entries which are appearing under Appearance > Menu > PortFolio Entries list and
accessible in Elementor Pro’s Template page builder as shown in the attached link.
T-shooting:
Can I tweak the Db to manually “repair” the menu item record?
Any Suggestion?
WP and all CPT plugins are up to date.
WP: 5.2.3
Active Theme: OceanWP 1.7.1
Advanced Custom Fields: 5.8.3
Advanced Custom Fields PRO: 5.8.4
Custom Post Type UI: 1.6.2
Ele Conditions: 1.0.5
Ele Custom Skin: 1.3.4
Elementor: 2.7.3
Elementor Pro: 2.6.2
Font Awesome: 4.0.0-rc13
Granular Controls Elementor: 1.0.5
Jetpack by WordPress.com: 7.8
MOJO Marketplace: 1.4.6
Ocean Extra: 1.5.16
PowerPack Lite for Elementor: 1.2.7.1
WPForms: 1.5.0.4
### Debug Info ###
Post Types:
{“portfolio_entries”:{“name”:”portfolio_entries”,”label”:”Portfolio Entries”,”singular_label”:”Portfolio Entry”,”description”:”Client, web design\/graphic art projects to be displayed in the portfolio various sections”,”public”:”true”,”publicly_queryable”:”true”,”show_ui”:”true”,”show_in_nav_menus”:”true”,”show_in_rest”:”true”,”rest_base”:””,”rest_controller_class”:””,”has_archive”:”true”,”has_archive_string”:”portfolio”,”exclude_from_search”:”false”,”capability_type”:”post”,”hierarchical”:”false”,”rewrite”:”true”,”rewrite_slug”:””,”rewrite_withfront”:”true”,”query_var”:”true”,”query_var_slug”:””,”menu_position”:”5″,”show_in_menu”:”true”,”show_in_menu_string”:”Portfolio Items”,”menu_icon”:”dashicons-portfolio”,”supports”:[“title”,”thumbnail”,”custom-fields”,”comments”,”revisions”],”taxonomies”:[],”labels”:{“menu_name”:”Portfolio Entries”,”all_items”:”All Entries”,”add_new”:”New Entry”,”add_new_item”:”Add New Entry”,”edit_item”:”Edit Entry”,”new_item”:”New Entry”,”view_item”:”View Entry”,”view_items”:”View Entries”,”search_items”:”Search Portfolio Entries”,”not_found”:”No portfolio entries found”,”not_found_in_trash”:”No portfolio entries found in Trach”,”parent_item_colon”:””,”featured_image”:””,”set_featured_image”:””,”remove_featured_image”:””,”use_featured_image”:””,”archives”:””,”insert_into_item”:””,”uploaded_to_this_item”:””,”filter_items_list”:””,”items_list_navigation”:””,”items_list”:””,”attributes”:””,”name_admin_bar”:””},”custom_supports”:””}}
Taxonomies:
{“portfolio_type”:{“name”:”portfolio_type”,”label”:”Types”,”singular_label”:”Type”,”description”:””,”public”:”true”,”publicly_queryable”:”true”,”hierarchical”:”false”,”show_ui”:”true”,”show_in_menu”:”true”,”show_in_nav_menus”:”true”,”query_var”:”true”,”query_var_slug”:””,”rewrite”:”true”,”rewrite_slug”:””,”rewrite_withfront”:”1″,”rewrite_hierarchical”:”0″,”show_admin_column”:”false”,”show_in_rest”:”true”,”show_in_quick_edit”:””,”rest_base”:””,”rest_controller_class”:””,”labels”:{“menu_name”:””,”all_items”:””,”edit_item”:””,”view_item”:””,”update_item”:””,”add_new_item”:””,”new_item_name”:””,”parent_item”:””,”parent_item_colon”:””,”search_items”:””,”popular_items”:””,”separate_items_with_commas”:””,”add_or_remove_items”:””,”choose_from_most_used”:””,”not_found”:””,”no_terms”:””,”items_list_navigation”:””,”items_list”:””},”meta_box_cb”:””,”object_types”:[“portfolio”]}}
### End Debug Info ###
]]>I know you recommend flamingo for saving entries into the database but I’d like to create this custom CPT for saving the entries as I’m planning to make the location of the CPT easily accessible for the client and some other custom setup as per the client requirements
I can work with Ajax in WordPress, I just need to know how to present the contact form from sending message and when all checks out (I.E verification and CPT has been updated), the CF7 can send user’s message and give user’s the appropriate CF7 response
I don’t know if CF7 uses something like this;
<?php
//if all Ajax checks out and updated CPT;
echo '1'; //response
else
echo '0'; //response if CPT is not updated
Die;
Then in the jQuery file that receives response
If response is '1', then send the message and give a success message
(I don't know if CF7 has something like WPCF7->send_mail )
and if response is '0', which means the CPT wasn't updated for some reason, message will not be sent and user Wil receive the CF7 error message
I have basic knowledge of what I want to do but not sure how or the right way to go about it. Please help
]]>