How to assign post to category

You have to register built-in “category” taxonomy for the “Activity” post type: <?php function add_categories_to_activities() { register_taxonomy_for_object_type( ‘category’, ‘activity’ ); } add_action( ‘init’, ‘add_categories_to_activities’ ); See register_taxonomy_for_object_type() in the Code Reference.

Filter custom WP_Query by first letter of a custom field – hopefully using Search and Filter Pro?

If Search and Filter Pro doesn’t help with this out of the box, it will take more effort to achieve this. What I would do: Move query to a separate function that would stay in functions.php file. It would return query results (example bellow). function theme_prefix_return_professionals($type=”professionals”, $fid = ‘204’) { $letter=””; $post_type = $type; $filter_id … Read more

How to replicate data storage and querying using WordPress. Custom posts/fields or Custom db tables?

This question is too broad for a concise answer but generally speaking I’d recommend: A custom post type Custom taxonomies (for grouping) Custom fields for arbitrary data (a plugin like Advanced Custom Fields will save a lot of time) You can query by both the taxonomy & custom fields using tax & meta queries. There’s … Read more

Multiple non-hierarchical custom taxonomies frequently used terms showing up in first selected taxonomy box

I found a solution that serves my purposes. I found this plugin (https://wordpress.org/plugins/radio-buttons-for-taxonomies/) that will allow me to use Radio Buttons for taxonomies instead of the tag cloud, so I avoid the bug with the tag cloud by using this interface instead. It only allows posts to be tagged with one term from each taxonomy … Read more

Need to display author’s email id in the “Edit post” field in wp dashboard. How do I do this?

Probably you use get_post on edit page with query object. You can simply use $post->post_author on edit page. For example; $editableid = get_query_var(‘id’); $postedit = get_post($editableid); $author_id = $postedit->post_author; //Always return author ID value. <input type=”hidden” name=”post_author” value=”<?php echo $author_id;?>” /> I hope this code piece helps you. EDIT : For email you use the_author_meta … Read more

How to redirect from wp-admin/edit.php to a frontend page for specific custom post type?

OK, this, put in functions.php works for me, based on this question and answer: /* Send users away from wp-admin/edit.php to page with ID 999 for post type my_post_type */ add_filter( ‘parse_query’, ‘filter_post_edit_screen’ ); function filter_post_edit_screen($query) { global $pagenow; if (is_admin() && $pagenow==’edit.php’ && $query->query[“post_type”] == “my_post_type”){ wp_redirect(get_permalink(999)); exit; } return $query; } don’t know … Read more

User Archive page for Custom Post Type – Pagination Issue

have you already tried this way? <section class=”posts-container”> <div class=”container”> <h2 style=”text-transform: uppercase;”>Posts from <?php echo get_the_author_meta( ‘display_name’, $author ); ?></h2> <?php $args = array( ‘post_type’ => array( ‘style’, ‘travel’ ), ‘posts_per_page’ => -1, ‘author’ => $author ); $author_videos = new WP_Query( $args ); if ( $author_videos->have_posts() ) : while ( $author_videos->have_posts() ) : $author_videos->the_post(); … Read more