Failed opening required

WordPress includes many functions for determining paths and URLs to files or directories within plugins, themes, and WordPress itself. $plugin_dir = plugin_dir_path( __DIR__ ); // wp-content/plugins/ require_once($plugin_dir.’WPNonce/WPNonce.php’); While using plugin_dir_path(), keep in mind that the “plugin” part of the name is misleading – it can be used for any file, and will not return the … Read more

Adding regular php file to site

You could accomplish this by setting up a redirect. If you’re using an Apache server, for your example, you would add this to .htaccess above the WordPress block: RewriteEngine On RewriteRule somepost.php ^/somepost/ It’s much more common, and recommended, to create a PHP file and a Page (or other post type) within wp-admin). This will … Read more

Why does WP load so many files in the head of source code? How do I optimize it?

First of all, search this site. This questions has been answered many times in the past: https://wordpress.stackexchange.com/search?q=clean+wp_head and https://wordpress.stackexchange.com/search?q=security+obscurity Secondly, there is a difference in what WP loads and what a theme and a plugin will load. Look in the theme functions file to see what the theme loads, i.e. javascripts and CSS. Look in … Read more

Running rmdir function on post save

Add this to your theme’s functions.php file: function wpse202681_save_post_action($post_id, $post_object, $update) { $folder = “/temp/files/”; delFolder($folder); } add_action( ‘save_post’, ‘wpse202681_save_post_action’, 10, 3 ); // + delFolder() function definition You will probably have to alter folder paths depending on your /temp/files/ location. This will execute everytime any post is saved. You can restrict it to only … Read more

How to edit php code in WordPress Post file?

You should never ever modify WordPress Core files. WordPress has an Plugin API (http://codex.wordpress.org/Plugin_API) that allows you to modify WordPress to your liking without changing Core code. In your case, the solution is to check the contents of the custom meta box fields before they are saved via the save_post action. If the content is … Read more

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