How to rename a custom field?
I found the answer UPDATE `wp_postmeta` SET `meta_key` = ‘ref’ WHERE `meta_key` = ‘refer’ use this part in your SQL Reference
I found the answer UPDATE `wp_postmeta` SET `meta_key` = ‘ref’ WHERE `meta_key` = ‘refer’ use this part in your SQL Reference
If your custom page template filename is foobar.php, you can use get_post_meta(): global $post; if ( ‘foobar.php’ == get_post_meta( $post->ID, ‘_wp_page_template’, true ) ) { // The current page has the foobar template assigned // do something } Personally, I like calling this inside my add_meta_boxes_page callback, and wrapping it around the add_meta_box() call itself. … Read more
I suspect the problem is coming from $MyCustomField which you enter as such in: ‘terms’ => array( $MyCustomField ), The query consider it as only one value: ‘64,72’, a string. So try: $MyCustomFieldValues = array_map( ‘intval’, explode( ‘,’, $MyCustomField ) ); This will also ensure your values are integers. Then: ‘terms’ => $MyCustomFieldValues,
you can use get_post_custom() which returns a multidimensional array with all custom fields of a particular post or page: echo ‘<pre>’; print_r(get_post_custom($post_id)); echo ‘</pre>’;
Here is the solution. Hope it will help you const { registerPlugin } = wp.plugins; const { PluginDocumentSettingPanel } = wp.editPost; const MyDocumentSettingTest = () => ( <PluginDocumentSettingPanel className=”my-document-setting-plugin” title=”My Panel”> <p>My Document Setting Panel</p> </PluginDocumentSettingPanel> ); registerPlugin( ‘document-setting-test’, { render: MyDocumentSettingTest } ); https://github.com/WordPress/gutenberg/blob/master/packages/edit-post/src/components/sidebar/plugin-document-setting-panel/index.js#L86
As Mamaduka said there is currently no (native) way of storing meta-data for taxonmies. There is talk of it. But it has stalled since its proving difficult to agree on how best to implement it. For large amounts of data you might not want to use the options table. Alternatively you can create your own … Read more
The meta_value is not of an integer type for max to return proper values. You can use mysql cast method to convert into integers as follows: SELECT max(cast(meta_value as unsigned)) FROM wp_postmeta WHERE meta_key=’price’
There is a plugin called Search everything, where you can break down what you want to search. It does custom fields, posts and of course titles.
please never do this: ‘value’ => $_GET[‘s’] … $query->get(‘s’);, get_search_query, or sanitize_key($_GET[‘s’]) are all safer options. Technically we shouldn’t be using get-params in wordpress at all, it’s not a best-practice. That get value could be all sorts of bad things, & we don’t want to pass it along to the db without making sure it’s … Read more
The second parameter in get_user_meta is optional, so you can retrieve all user meta like this (code tested quickly in my install): $cu = get_current_user_id (); $um = get_user_meta ($cu); var_dump ($um); This would also include meta fields that are hidden on the user profile page.