Comapare get_user_meta value

You can use meta_key or meta_query to fetch users where get_user_meta() ‘val’ == 1 Option 1: $users = get_users(array( ‘meta_key’ => ‘val’, // your_meta_key ‘meta_value’ => ‘1’, // value you want to compare ‘meta_compare’ => ‘=’, )); Option 2: $args = array( ‘meta_query’ =>array( array( ‘key’ => ‘val’, //your_meta_key ‘value’ => 1, // value of … Read more

.html end of URl affected to SEO?

If you currently have /path/to/site.html and change it to /path/to/site, this will affect SEO, as search engines think they know the url (the former). However, there are solutions to this. You can either keep the .html at the end of the URL (there should be no problem to use a WordPress permalink with .html in … Read more

Echoing a CSS class based on category of post in a list

get_category(’91’) is always going to return an object of category ID 91’s data. This means your if statement is always going to return as true. You need to get the current iterated posts assigned category ID and then check if it is 91. <!– Return objects of current iterated posts associated categories –> $categories = … Read more

Can’t get url_to_postid to work

Probably because you don’t have a colon in the url after https (assuming you copied the $url parameter correctly). The function will return a ‘0’ if the page does not exist.

How to add page numbering with php?

to change the number of ‘posts_per_page’ for one specific category archive page (assuming your are using a different number for all other archives), try working with the ‘pre_get_posts’ action; see https://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts assuming that your category template is for the ‘video’ category, the code to be added into functions.php of your (child) theme, could be, for … Read more

How to delete all categories programatically?

Please have look on the below code block- $args = array( “hide_empty” => 0, “type” => “post”, “orderby” => “name”, “order” => “ASC” ); $types = get_categories($args); foreach ( $types as $type) { wp_delete_category( $type->ID ); } The function wp_delete_category will delete a single category. So we need to run a loop through $types to … Read more

export a mysql table to csv with column headers

You should build Your columns schemat in array. Than add this on the top of csv and than You can add content of Your csv. $string_headers=”post_title,post_author,etc….”; if(count($results) > 0) { $result = $string_header; foreach($results as $result){ $tmp_result = array_values($result); $result .= implode(“, “, $tmp_result); $csv_output .= $result.”\n”; }

Where to copy woocommerce files to in my custom theme to avoid editing the core plugin?

To override WooCommerce (WC) templates, put your modified templates in custom_theme/woocommerce/template-category/template-name.php Example: To override the admin order notification, copy: wp-content/plugins/woocommerce/templates/emails/admin-new-order.php to wp-content/themes/yourtheme/woocommerce/emails/admin-new-order.php WC Documentation Reference