How i can obtain all the post meta for a specific post as an array?

there is no single function you can use but you can create your own something like: function get_all_post_fields($post_id){ $p[‘standard’] = get_post($post_id, ARRAY_A); $p[‘meta’] = get_post_custom($post_id); return $p; } then once you have this in your functions.php file you can use it: $fields_all = get_all_post_fields($ID); Update: If you have just the title then i have a … Read more

Defining the same price to all WooCommerce Products

Looks like you are not familiar with WordPress Bulk Edit. Change the Screen Options to show all the products you have (if there are too many this can be slow, and is better to do it following some 100/200 product per page). Select all the products, select Edit in the Bulk Edit dropdown and Apply. … Read more

Copyright: Get first and last date of post type

There was an issue with the code originally posted by kaiser in that it queried for year, month and day distinctly resulting in values representing “the largest month for any date” or the “smallest day for any date” rather than values representing the MAX and MIN dates globally. I altered that original code to query … Read more

Order posts alphabetically: how to set order=asc in mysql query?

Why don’t you use WordPress get_posts? You can add the parameter orderby => ‘title’ as you want. $args = array( ‘posts_per_page’ => -1, ‘order’ => ‘ASC’, ‘orderby’ => ‘title’ ); $posts = get_posts( $args ); print_r($posts); If you want the sql you can just add ORDER BY post_title: SELECT * FROM $wpdb->posts WHERE post_type=”post” AND … Read more

What should a WordPress developer know about MySQL? [closed]

Questions like this usually yield a lot of discussions, but let me give it a shot: If you’re talking about SQL queries: If you’re only adding content, managing plugins, themes and WordPress updates, there’s a 99.9% chance that you will never need to write a single line of it. I don’t want to put 100% … Read more

Remove a shortcode from all WordPress posts

I love to use this tool, Search and Replace for WordPress Databases. It is basically a PHP script that is written for WordPress usage (but of course can be used with any database). When placed in the WordPress project, it automatically detects and loads the Database using data from wp-config.php file. It enables you to … Read more

Way to bulk make all my tags lowercase?

I would highly suggest that you use CSS to do this, as mentioned per other answer. Still, if you need to update the database due to some technical business, here’s the way to go. First, we will try and fetch all the tags using the get_terms() function, then we will update everyone of them using … Read more

Not connecting to database in file with multiple MySQL connections

When you include wp-load.php, WordPress will load wp-config.php, where constants with the same identifiers you have chosen here are already defined. This should be throwing warnings regarding the duplicate definition. Because you cannot re-define constants, the values you are attempting to set in this file are ignored. Choose different names for them if they are … Read more