Login to wordpress using another sites authentication.

What you’re after is called Single Sign On or SSO. You would essentially be bypassing WordPress’ authentication methods and use those from a 3rd party. WordPress needs a local user of some kind for normal operations to work (the user_can() function for example.) So the general gist would be something like this – Send any … Read more

Remove   in post content

As per comments on the original post, it appears this is as a result of copying text from another source. Unfortunately, copying and pasting can bring across whatever junk the source editor decides to include. MS Word has typically been terrible at this; WordPress now does a pretty good job at cleaning it up but … Read more

Removing custom sort order from admin page listing

By default pages are order by menu_order then title. When you are adding filter country you are ordering them by meta_value There are two options Remove everything that you added country and orderby pages will be back to default order. If you can not remove orderby but can remove country then adjust your code in … Read more

Custom posts password protect

Use post_password_required() function to check if the post is protected. <?php global $post; $p = $post; // can be post object. // $p = $post->ID; // also can be post ID. $this_post_type = get_post_type( $p ); if ( ‘my_custom_post_type’ === $this_post_type ) { // check the post type. if ( ! post_password_required( $p ) ) … Read more

How can I use custom menus with a Bootstrap WordPress theme?

You can change the classes of the <ul> by adding ‘menu_class’=>’nav navbar-nav’ to your $args array. Remember, this parameter overwrites all the classes, so add “menu” as well if you want many themes and plugins to work! If you don’t want the outer <div>, you can “unwrap” the <ul> by adding ‘container’=>false. $args = array( … Read more

Use variable in SQL statement

Firstly, as a PHP rule, you don’t need to echo a variable when doing a string concatenation. Secondly, you need to prepare your query when adding a variable inside. So your query would become like this: $prepared = $wpdb->prepare( “SELECT meta_value FROM wp_woocommerce_order_itemmeta WHERE meta_key = ‘_wc_checkout_add_on_label’ AND order_item_id = %s”, $orderID ); $size = … Read more