I'm attempting to pull in some order information from the "shop_order" post_type. This is on a multisite network, so I'm using switch_to_blog(1). When I set the post type as "post" it works great and I get the posts from the correct site. When I set the post_type to "shop_order" I get nothing, despite there being 20,000 'shop_order' records in the database. switch_to_blog(1); $args = array ( //'post_type' => 'post', 'post_type' => 'shop_order', 'posts_per_page' => 2, ); $posts = get_posts( $args …
I want to set "manage_categories" capabilities on a post_type taxonomy but not on the general categories? I've added to register_taxonomy: 'manage_terms' => 'manage_categories', 'edit_terms' => 'manage_categories', 'delete_terms' => 'manage_categories', 'assign_terms' => 'read' 'edit_post' => 'edit_video', 'read_post' => 'read_video', 'delete_post' => 'delete_video', 'delete_others_videos' => 'delete_others_videos', 'edit_posts' => 'edit_videos', 'edit_others_posts' => 'edit_others_videos', 'publish_posts' => 'publish_videos', 'read_private_posts' => 'read_private_videos', How do I prevent this user from managing the general site's categories and edit only these post type taxonomies categories? What should I add? …
I am trying to create a filter using restrict_manage_posts that will filter all media according the page or post type that have been attached to. Actually i need to create a filter that refers to the Uploaded to column. I have been trying many variations with no luck. function media_add_uploaded_to_dropdown() { $scr = get_current_screen(); if ( $scr->base !== 'upload' ) return; $attached_page = filter_input(INPUT_GET, 'attached_page', FILTER_SANITIZE_STRING ); $selected = (int)$attached_page > 0 ? $attached_page : '-1'; $args = array( 'show_option_none' …
In WP 3.1, it appears that setting 'exclude_from_search' = TRUE for a custom post type excludes the post type not just from searches on the front-end, but also from any post query using 'post_type' = 'all'. I can imagine plenty of scenarios where a plug-in developer would want to access ALL post types, even those excluded from front-end searches. Is this a bug, or is it just poorly documented? Backstory: I have a custom post type using a custom "Post …
Been trying to get this working all day but haven't had any luck... I have a custom post type called 'news' and an archive template (archive-news.php), here I'd like to show 2 posts with pagination, which works fine, until I try to go to the 'next page' (/news/page/2) which returns an error 404. Any idea how to fix this / what I'm doing wrong? I've literally spent all day trying to find a solution to this by searching Google and …
Im trying to do something with an admin_init hook if - and only if - the user is editing a post (post.php) with post type "event". My problem is that, even though wordpress points to a global variable calls $post_type. if i do: global $post_type; var_dump($post_type); It returns NULL. but if I do this: global $pagenow; var_dump($pagenow); it returns my current page. i.e. "post.php". I looked into this function $screen = get_current_screen(); but thats not declared until after the admin_init …
I've created a custom Post type called 'Data' to display content on a Wordpress site. The content works and is displayed if viewed when signed into Wordpress. Howevever, if you view the same URL when not signed into Wordpress (Incognito), the page appears blank. Is there a soultion to this? Snippet from functions.php: // Our custom post type function function create_posttype() { register_post_type( 'Data', // CPT Options array( 'labels' => array( 'name' => __( 'Data' ), 'singluar_name' => 'Data', ), …
How to change the listing type permalink? I tried changing it from the admin dashboard permalink field but it’s not working. I am using MyListing theme, i tried to reach them but no response till now so posting it here.
At first sorry for my bad English! I try to hide #mceu_27-body and #wp-content-editor-tools on products page (editing mode) like on the pics for certains authors! This work find : add_action('admin_head', 'wwc_my_custom_css'); if (!current_user_can('edit_pages') ) { function wwc_my_custom_css() { echo '<style> #mceu_27-body, #wp-content-editor-tools{ display:none !important; } </style>';} } But it affect all posts type and I just want it on products post type so I tried that but it doesn't work : add_action('admin_head', 'wwc_my_custom_css'); if (!current_user_can('edit_pages') && is_product() ) function …
I am using my WordPress posts to generate excerpts to go to an outside URL instead of the permalink. I know how to set a custom post type's: public => false but I don't know how to do this for the native WordPress blog. I don't want a permalink page generated because I don't want duplicate content. Is there something I can add to the functions file for this? Also, I'm not sure if I should be using publicly publicly_queryable …
I'm trying to display the full size image of the single post from a custom post type that I created, below is what I've tried <?php $args = array( 'post_type' => 'press', 'order' => 'ASC', 'post_status' => 'publish', 'suppress_filters' => false ); $press = new WP_Query( $args ); if ( $press->have_posts() ) { ?> <?php while ( $press->have_posts() ) : $press->the_post(); ?> <div class="col-sm-4 mb24"> <article class="post-article bg-white"> <div class="article-img"> <?php if( has_post_thumbnail() ){ ?> <div class="img-box position-relative overflow-hidden"> <a …
I have this code for breadcrumbs that works fine except the custom post type parent category URL and the category TITLE. The parent category URL is does not return the valid (correct) slug while its title (anchor) returns a text with description on it like CATEGORY - BOOKS. Although I am a bit of a mediocre in coding but I am open for learning. I figured out the code responsible for displaying the invalid parent category is below elseif ( …
I can delete the comment from the database with this code, however when the page is loaded again the comment will still be there. I need to update again to disappear. How do I resolve this? <?php if( 'POST' == $_SERVER['REQUEST_METHOD'] ) { set_query_var( 'commentid1', $_POST['commentid'] ); wp_delete_comment( get_query_var( 'commentid1'), true ); }; ?> <form class="delete-comment" action="" method="post"> <input type="hidden" name="commentid" value="<?php comment_ID() ?>" /> <p align="right"> <input type="submit" value="Delete" title="Delete" /> </p> </form>
I wanted to know, why my single custom post type isn't working. Everytime I wanted to open the single post type it automatically gets back to the homepage. Please help! Here is my code: // Team im Backend hinzufügen function register_team() { $labels = array( 'name' => __( 'Team', 'team' ), 'singular_name' => __( 'Team', 'team' ), 'add_new' => __( 'Neues Mitglied', 'team' ), 'add_new_item' => __( 'Neues Mitglied', 'team' ), 'edit_item' => __( 'Mitglied bearbeiten', 'team' ), 'new_item' => …
By default Wordpress private posts are visible to all admins right. But on this build for some reason private posts are only displaying (on the page) to the admin that created it. I'm perplexed. I need all admins to see the private posts displayed. This is a custom post type using a custom query so maybe there's something I did there. // query upcoming webinars - Sort by date from date Picker $args_upcoming = array( 'cat' => $thiscat_id, 'numberposts' => …
Sometimes I have duplicate IDs between Post Types and Taxonomies, I know this happens because they are stored in different tables but I wish it was possible to have a unique ID for each thing in WP, is there a way to achieve this?
I want to remove the post meta from all post types that are not "posts" from my site or at least from the search results. Im currently using the Jnews theme and in the search results page I get all post types (posts, pages, products) but I'm only interested in leaving the post meta (.jeg_post_meta) for posts and removing it for all other post types like pages, products and others that the results page can bring. .jeg_post_meta is the style …