How to get title tag of an external page with http api?

here is a function i have for that: function get_page_title($url){ if( !class_exists( ‘WP_Http’ ) ) include_once( ABSPATH . WPINC. ‘/class-http.php’ ); $request = new WP_Http; $result = $request->request( $url ); if( is_wp_error( $result ) ) return false; if( preg_match(“#<title>(.+)<\/title>#iU”, $result[‘body’], $t)) { return trim($t[1]); } else { return false; } } Usage: $title = get_page_title(‘http://www.google.com’); … Read more

Remove the http protocol from images

The code you provided could cause issues with 3rd party URLs in hyperlinks not running https. You can fix this by including your home url, e.g: $content = str_replace( set_url_scheme( home_url(), ‘http’ ), set_url_scheme( home_url(), ‘relative’ ), $content); Next, you’re applying this when you’d like to display the content, which means you need to do … Read more

Remove rel=shortlink from HTTP header

<?php add_filter(‘after_setup_theme’, ‘remove_redundant_shortlink’); function remove_redundant_shortlink() { // remove HTML meta tag // <link rel=”shortlink” href=”http://example.com/?p=25″ /> remove_action(‘wp_head’, ‘wp_shortlink_wp_head’, 10); // remove HTTP header // Link: <https://example.com/?p=25>; rel=shortlink remove_action( ‘template_redirect’, ‘wp_shortlink_header’, 11); } Tested in WordPress 4.4 and up to 4.9.1

Is curl required?

For the record, I have uninstalled curl and wordpress was working on seamlessly. So I confirm that curl is not a dependency of wordpress. However, some plugins may require curl.

How do I troubleshoot responses with WP HTTP API?

We tracked it down to content-encoding’ => string ‘deflate’ (length=7) being at fault. WP_HTTP is adding in a deflate header for no reason and un gzip compressing the results. It only happens when the body of the response is under a certain string length. Very annoying when all you want isa 1 or a 0. … Read more

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