Custom Meta Field – Youtube embed

Maybe it’s better to use a textarea instead of an input field. And of course $allowed doesn’t contain the iframe tag. And for sure you will be not able delete the saved video_1… Too many things not really good in this code. 1) $values = get_post_custom( $post->ID ); $video1 = isset( $values[‘video_1’] ) ? esc_attr( … Read more

How to remove Profile Picture section or the message “You can change your profile picture on Gravatar.”

To remove the profile picture row of the table (which includes the gravatar link): jQuery( “tr.user-profile-picture” ).remove(); To remove that entire “about yourself” table: jQuery( “tr.user-profile-picture” ).parents(“table:first”).remove(); Use this type of jQuery call, don’t try to get fancy with the loop. This is on WP 4.4; earlier versions may have different HTML class names for … Read more

Passing Variable as URL Parameter — Security concerns?

Passing non-private/non-protected/non-sensitive values through the URL is quite widely used and a more reliable way of passing values from one page to another. The reason for this is, $_SERVER[‘HTTP_REFERER’] is totally unreliable and can never be trusted. It can also, in many case be an empty value. Check the two following posts for more details … Read more

How to filter or search the posts using postmeta tables custom meta fields with wordpress REST API

You will need to add custom query vars: add_filter(‘rest_query_vars’, ‘wpse225850_add_rest_query_vars’); function wpse225850_add_rest_query_vars($query_vars) { $query_vars = array_merge( $query_vars, array(‘meta_key’, ‘meta_value’, ‘meta_compare’) ); return $query_vars; } Now, get your posts at example.com/wp-json/wp/v2/posts?filter[meta_key]=property_featured&filter[meta_value]=1. You can follow this ticket for more info.

Add custom field (value) to search result (without plugin)

WordPress search in posts table. You must change the search query by adding a postmeta table (with LEFT JOIN) and then add your own conditions to WHERE clause. <?php /** * Extend WordPress search to include custom fields * * https://adambalee.com */ /** * Join posts and postmeta tables * * http://codex.wordpress.org/Plugin_API/Filter_Reference/posts_join */ function cf_search_join( … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)