Echo the custom field value from the latest post from the ‘video’ post format?

While this may not answer your question, but it will be helpful to solve it. It seems like the statement $video = get_post_meta($postid, ‘dt_video’, true); is assigning blank string value to $video variable and thus iframe code becomes <iframe width=”180″ height=”101″ src=”https://wordpress.stackexchange.com/questions/139255/?rel=0″ frameborder=”0″ allowfullscreen></iframe> which is the cause of your site being displayed in the … Read more

Hide custom metabox value from custom fields

Custom fields or post meta entries can be hidden from the by default in WordPress available »Cutom Fields«-Metabox by prefixing them with a underscore – _ – as noted here. As addition, if you want hidden fields to be visible during development you can do that easily – take a look at this answer to … Read more

Notice: Trying to get property of non-object in : custom fields category

Most probably the term was not found and $current_term returned as false: $current_term = get_term_by( ‘slug’, $term_slug, $taxonomyName ); $term_id = false === $current_term->term_id ? null : $current_term->term_id; According to the docs, get_term_by() return values are Term Row (object or array) from database. Will return false if $taxonomy does not exist or $term was not … Read more

filter wp_query result with custom field values

If main_category is a category (custom taxonomy), then you’re querying it wrong. This should go like this: $electronics = array( ‘numberposts’ => -1, ‘post_type’ => ‘article’, ‘main_category’ => ‘electronics’ ); $query_electronics = new WP_Query( $electronics ); If that’s a custom field, use meta_query: $electronics = array( ‘numberposts’ => -1, ‘post_type’ => ‘article’, ‘meta_query’ => array( … Read more

Add field to user meta table in database when link is clicked

Personally, I would store the post IDs (as opposed to URLs). Something like: function wpse_143643_add_user_bookmark() { if ( ! empty( $_GET[‘bookmark’] ) && is_singular() && is_user_logged_in() ) { if ( ! $bookmarks = get_user_meta( $user_id = get_current_user_id(), ‘bookmarks’, true ) ) $bookmarks = array(); $bookmarks[] = get_queried_object_id(); $bookmarks = array_unique( $bookmarks ); update_user_meta( $user_id, ‘bookmarks’, … Read more

Create a list of posts with topic headdings

OK I got it working. Not sure if it is the best way but I thought I would add a reply anyway. Set up the information needed for the custom loop using $args = array As described in http://codex.wordpress.org/Class_Reference/WP_Query $args = array( ‘post_type’ => ‘product’, ‘meta_key’ => ‘wpcf-topic’, ‘orderby’ => ‘meta_value’, ‘order’ => ‘ASC’, ‘posts_per_page’ … Read more