media_sideload_image results in http error (500)

The media_sideload_image() function is only available in the admin by default, and init runs on all page loads. See the Codex article: If you want to use this function outside of the context of /wp-admin/ (typically if you are writing a more advanced custom importer script) you need to include media.php and depending includes: require_once(ABSPATH … Read more

Change behavior of the “ADD Media” buttom

Js file (function() { tinymce.PluginManager.add( ‘custom_class’, function( editor, url ) { // Add Button to Visual Editor Toolbar editor.addButton(‘custom_class’, { title: ‘Insert PDF Tag’, cmd: ‘custom_class’, image: url + ‘/icon.png’, }); // Add Command when Button Clicked editor.addCommand(‘custom_class’, function() { var text = editor.selection.getNode(); if ( text.length === 0 ) { alert( ‘Please select some … Read more

Use wget to find used images

Your asking for command line solution, I don’t have one – but for PHP you can cycle through all posts, build an array of files, compare it to an array of the media library, find unused and delete. Cycle through Posts use get_posts() for pages andor posts, and build your foreach loop Extract Media From … Read more

Moving wp-content folder to public_html

I was able to fix this problem by using this code instead of the one above: define(‘WP_CONTENT_DIR’, $_SERVER[‘DOCUMENT_ROOT’] . ‘/wp-content’); define(‘WP_CONTENT_URL’, ‘http://’ . $_SERVER[‘HTTP_HOST’] . ‘/wp-content’);

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