| bio | website | |
|---|---|---|
| location | ||
| age | ||
| visits | member for | 5 months |
| seen | Apr 6 at 6:52 | |
| stats | profile views | 2 |
|
Feb 28 |
comment |
Trying to get property of non-object wordpress error message I also confirmed the above on my main home page. If I have 1 post published the plugin is fine. But if no posts are in my system it errors. Since my custom taxonomy page publishes drafts not published posts I get the error on that page of my site but not other pages of my site. Now I just have to find out where to fix the plugin. |
|
Feb 28 |
comment |
Trying to get property of non-object wordpress error message thank you again for the explanation. I tried but still getting the error. Here is what I think is causing the error. In my custom taxonomy all of my posts are set to draft. If the meta field is set to paid then the post will be set to publish. May custom taxonomy page will find this post in this query query_single('dealers', 'publish', '1', $taxtype, $value); which is a new wordpress query not query_posts. The error is not actually happening due to no results in query. The error happens because there are no post in my taxonomy set to published. |
|
Feb 28 |
comment |
Trying to get property of non-object wordpress error message @s_ha_dum I assume you mean if I leave the original wordpress query in place. It does work in this instance. But that is not an option on this custom taxonomy page. I need a custom query. And when that query actually returns results I don't get the error message. But when the query has no result the error message happens. And that error only happens when the plugin is active. If the plugin is not active no error notice. Any ideas? |
|
Feb 27 |
asked | Trying to get property of non-object wordpress error message |
|
Feb 16 |
comment |
Theme Functions run a function upon activation or preview thank you so much. That worked to solve the issue. One minor error in your code { at opening of the if statement. Thank you again! |
|
Feb 16 |
accepted | Theme Functions run a function upon activation or preview |
|
Feb 15 |
awarded | Editor |
|
Feb 15 |
comment |
Theme Functions run a function upon activation or preview Thank your for the reply. I used your code and got this error Warning: Cannot modify header information - headers already sent by (output started at /home3/an/public_html/wp-content/themes/tipztheme/functions.php:1) in /home3/answerun/public_html/wp-includes/pluggable.php on line 876 I updated the full code above, perhaps that is causing the error with isset. Any ideas? |
|
Feb 15 |
revised |
Theme Functions run a function upon activation or preview added 660 characters in body |
|
Feb 15 |
asked | Theme Functions run a function upon activation or preview |
|
Jan 16 |
awarded | Tumbleweed |
|
Jan 8 |
accepted | wpdb->prepare function remove single quote for %s in SQL statment |
|
Jan 8 |
asked | wpdb->prepare function remove single quote for %s in SQL statment |
|
Dec 26 |
awarded | Nice Question |
|
Dec 21 |
comment |
Should I use Pre Get Posts or WP_Query Thank you for the reply and example. But I think I might be trying to use pre_get_posts when I should just be doing a new wordpress query. I was trying to save a query, but in my case it might not be possible. The reason being is all the arguments you set in the parameter, I wanted to pass to the function from my taxonomy.php file. So $paidvalue=”1” might be 1 or 0 depending on which condition I am executing in taxonomy.php. It seems pre_get_posts above fires right when the page loads even if I don't call the function in my taxonomy.php file. Am I seeing this correct? |
|
Dec 19 |
awarded | Supporter |
|
Dec 19 |
comment |
Should I use Pre Get Posts or WP_Query M-R Thank you for the reply. I read up on add action and I see I should be assigning a priority and arguments number. So I changed my add action to <code>add_action('pre_get_posts', 'custom_pre_get_posts', 10,7);</code> Then in my taxonomy.php page I <code> do_action('pre_get_post', $query, 'dealers', 'publish', '1', $taxtype, $geo, $brands);</code>. But I am still getting the same error. I was not sure where to put default values. I tried google but could not find a reference. Can you give me a little more information on where how to handle this? |
|
Dec 19 |
awarded | Scholar |
|
Dec 19 |
accepted | Should I use Pre Get Posts or WP_Query |
|
Dec 19 |
comment |
Should I use Pre Get Posts or WP_Query Thank you very much for the reply. It is very helpful. One quick question. I placed the function in my theme function.php file. I run this function custom_pre_get_posts($query) from my taxonomy.php. In the taxonomy.php I set up the variables, $posttype, $post_status, $geo, $brands, $taxtype and run two loops changing these variable. Is there a way to pass variable into the above function from taxonomy.php? When I try custom_pre_get_posts($query,'dealers', 'publish', '1', $taxtype, $geo, $brands); I get Missing argument 2 thru 7 for custom_pre_get_posts(). I assume due to add_action??? |