How to fix the error “file_get_contents was found in the file functions.php”?

To Add External Atylesheet: Generally speaking, you should use the wp_enqueue_style() function to add external stylesheet to your theme. function wpse259600_add_style() { wp_enqueue_style( ‘theme_critical’, get_template_directory_uri() . ‘/css/critical.css’, array(), ‘1.0.0’ ); } add_action( ‘wp_enqueue_scripts’, ‘wpse259600_add_style’ ); To Add Internal Stylesheet: However, if (for whatever reason) you have to add internal stylesheet (i.e. printing the entire CSS … Read more

Copy a file from a plugin into my theme directory

To answer your question, you have specified the paths incorrectly: plugin_dir_path( __FILE__ ) already has a trailing slash at the end (having two trailing slashes should not be a problem, but safer is to have one) and get_stylesheet_directory() comes with no trailing slash at the end, so you have to add one before adding the … Read more

Convenient way to use wp_filesystem

No, there is not a more convenient way. The thing is, your first example is insecure on the most common hosting systems because the directory will be “owned” by whatever user the webserver itself is running as. Thus, anybody else able to execute code on that same webserver will be able to access it, write … Read more

Call to a member function put_contents() on a non-object

Initialize the WP filesystem and no more using file_put_contents function. Try this: […] global $wp_filesystem; // Initialize the WP filesystem, no more using ‘file-put-contents’ function if (empty($wp_filesystem)) { require_once (ABSPATH . ‘/wp-admin/includes/file.php’); WP_Filesystem(); } if(!$wp_filesystem->put_contents( $path, $css, 0644) ) { return __(‘Failed to create css file’); }

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