By default, custom post types are not included in the search results, so we are going to create a function that allows them to be queried and searched by WordPress. You can include custom post types in the search result by adding below function in your functions.php file.
This is a place where you can quickly reference elements from wp-admin.
You can use them in your own plugins.
If you don’t want to deal with the messy process of loading WordPress manually, you can just use WP-CLI’s eval-file command:
This function checks in each directory level starting from the directory of the current file for the file wp-config.php. If it is found the directory is to be assumed the wordpress base path. The check can of course be changed to other wordpress core files.
Php class that downloads a remote image, moves it into the /uploads/ directory of your site, adds it to WordPress as a new attachment and returns to you the attachment ID.
This is a php function you can use to remove base url prepended to image loaded from remote host. Just copy this script and drop it in your theme function or plugin.