How to delete Passwrd Protected posts cookies when a user logged out from the site

The post password cookie is set with: setcookie( ‘wp-postpass_’ . COOKIEHASH, $hasher->HashPassword( wp_unslash( $_POST[‘post_password’] ) ), $expire, COOKIEPATH, COOKIE_DOMAIN, $secure ); in the wp-login.php file. We can then use the clear_auth_cookie hook, in the wp_clear_auth_cookie() function, to clear it on logout: /** * Clear the Post Password Cookie on logout. * * @link http://wordpress.stackexchange.com/a/198890/26350 */ … Read more

How to override a plugin function wrapped in a class?

if the modification is called in the action admin_menu you can come just after, in order to correct the menu with some code like this : add_action(“admin_menu”, function () { $parent_file=”parent.php”; $full_url = add_query_arg( ‘action’, ‘action-name’, admin_url( ‘users.php’ ) ); global $submenu; // searching the last submenu $last = array_pop($submenu[$parent_file]); // correcting the URL $last[2] … Read more

Widget with same content across several websites

for the idea of storing data on the provider webside, it’s a good idea but I recommend to use JSON onstead of XML. it’s a litte bit faster to parse and you will save a litte bit bandwith on the provider side, you can use the WordPress AJAX helpers to make somethig like that : … Read more

Reduce Drop down Menu Width in WordPress

It’s a css issue. You need to edit two selectors. First is the menu width. It’s set to 100% which is why you’re seeing black space. Edit this class below.: .cap-primary-menu .menu > li.menu-full-width .cap-submenu-ddown { padding: 20px 25px 25px; width: 100%; // set this to auto or something smaller than 100% left: 0; border: … Read more

Does WordPress merges a plugin folder during update?

Tested unconventionally: Created a folder in Desktop named abc – timestamp 12:00:00 Created another folder named abc somewhere else after a second – timestamp 12:00:01 Copied second one and paste on desktop > Want to replace? > Yes Folder abc (first one) replaced with folder abc (second one) Result: Timestamp stayed same as previous 12:00:00 … Read more

Automatically add attributes to woocommerce product?

add_action( ‘save_post_product’, ‘create_product’, 10 ); function create_product( $post_id, $post) { // $post_id and $post are required if ( empty( $post_id ) || empty( $post ) ) { return; } // Dont’ save meta boxes for revisions or autosaves if ( defined( ‘DOING_AUTOSAVE’ ) || is_int( wp_is_post_revision( $post ) ) || is_int( wp_is_post_autosave( $post ) ) … Read more

Making a plugin “Suite”?

As far as I know there is no way to “group” plugins into one. Although, there is a way to hide plugins. Just add following snippet to your current theme’s functions.php file: function hide_plugin_trickspanda() { global $wp_list_table; $hidearr = array(‘plugin-directory/plugin-file.php’); $myplugins = $wp_list_table->items; foreach ($myplugins as $key => $val) { if (in_array($key,$hidearr)) { unset($wp_list_table->items[$key]); } … Read more