How to add add_meta_box to specific Page Template?

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

Add metabox to document tab in gutenberg

Here is the solution. Hope it will help you const { registerPlugin } = wp.plugins; const { PluginDocumentSettingPanel } = wp.editPost; const MyDocumentSettingTest = () => ( &ltPluginDocumentSettingPanel className=”my-document-setting-plugin” title=”My Panel”&gt &ltp>My Document Setting Panel&lt/p> &lt/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

Attaching Metadata to a Taxonomy Item

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

Add custom fields to search

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

Saving custom data for each user

Take a look at update_user_meta you can save user data if they are registering or signed in, its just a matter of what user ID you pass to it. say in your function to save the user data after he is logged in: function save_user_data_7231(){ global $current_user; if is_user_logged_in{ //check if user is logged in. … Read more

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