Tag Info

Hot answers tagged

3

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 ...


1

If you var_dump($hometeams); you will see that $hometeams->post is set to the first post in the query results even before $hometeams->the_post runs. WP_Query initializes it automatically if you have posts in the result set. The "Undefined Property" warning occurs when your result set is empty, and thus $hometeams->post can't be set/initialized. ...


1

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 ...


1

I found a soloution and what causes it. It was not really the delimiter that was the problem it was becasue a user made duplicate posts. Solution: Replace $notify_message .= preg_replace('#[\s]+#', ' ',sprintf( get_comment_meta($comment->comment_ID, 'title',1))) .' skrev:'. "\r\n" . $comment->comment_content . "\r\n\r\n"; With ...



Only top voted, non community-wiki answers of a minimum length are eligible