How to properly setup an activation hook

You first example looks corrent. There is however a typo, hence class ‘MyPluginAdmin’ not found. You include myplugin-admin.php, but then your question seems to suggest the page holding the class is in fact my-plugin-admin.php (with a hypen). If I correct the typo and run the code there are no warnings. Edit (this works correctly): my-plugin.php: … Read more

Ajax stops working when logged in?

A few things that I see: There’s a space in your first add_action declaration. Should be add_action(‘wp_ajax_wppl_function’, ‘wppl_function’); Have you declared wppl_function to run it? Have you localized your scripts when logged in? Please review the codex entry on wp_ajax_nopriv (action)

Removing warnings and notices from production servers

As many have already commented, it is better to fix the source of the issue than to hide the messages. That said, these types of messages should never be displayed on production server but, since you just never know, it is also a good idea to disable them on all servers (local development machine, development … Read more

Undefined property: WP_Query::$post

First of all post field of WP_Query is current post ID and not post object. But I don’t think you should use it before calling the_post() method. Normally you should do it in this way: $args = … $hometeams = new WP_Query( $args ); $teamishome = $hometeams->have_posts(); while ( $hometeams->have_posts() ) { $hometeams->the_post(); $scorehome = … Read more

Warning: array_pop() expects parameter 1 to be array, boolean given

get_the_terms() will return a boolean false under some circumstances: A post with no terms assigned gives a false result, not an empty array. https://codex.wordpress.org/Function_Reference/get_the_terms#Returns It sounds like that is what is happening. You need to check that $post_link = to ensure that it is the type you expect before trying to use it.

Get WP CLI to hide debug warnings and notices in JSON output, same setting as website

A quick manual solution is to direct all error output to a log file somewhere or even to /dev/null. With your command this would look like this: wp plugin list –fields=name,status,update,version,update_version,title –format=json 2> ./cli-command.err.log If you totally don’t care about the errors, warnings and notices, you could send it to /dev/null like this: wp plugin … Read more

WordPress Errors in generated by theme check plugin [closed]

File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls. The WordPress coding styles require that you make use of the WP Filesystem instead of using direct PHP file functions. You can replace your file_get_contents call easily with: $response = wp_remote_get($feed_url); $file_content = $response[‘body’]; For more specific infos just take a look … Read more

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