Conversation
supportHello: First of all, thanks for such a great and useful plugin. I have been using it to get some information in real time and it works perfectly well. I have been using $wpdb global variable without any problem, but unfortunately when using $post it seems to be always empty although it has been declared as global in the function. Am I missing something? Could this be solved? Thanks!
Hi @raperez for me, it’s difficult to understand what you are trying to do because I don’t know the code of your function. However, I suggest you try to add the parameter request=”remote” to the shortcode. I mean the shortcode will look like [content_no_cache id=”xxx” request=”remote”] Normally, CNC gets the content of the CNC element during an Ajax call directly from the database. Your $post variable may not work during the Ajax call. If you add the parameter request=”remote”, CNC will get the content via a remote HTTP request, and in that case, the same $post variable may work. The content will appear a little later on the page, but you may solve the issue. I hope it helps Have a great day Jose
Hello: I have created a shortcode to recover some data from a table. To search in this table, I must recover a value from the actual post (global $post) where the shortcode is located. Unfortunately, this variable is empty when called via no content cache. I have also tried request=”remote” parameter with no luck. When using the request=”remote” parameter my shortcode doesn’t work at all and I get an update error when trying to update the page where the shortcode is located. Any other thing that could be done? Thanks again for your fantastic help!! This reply was modified 2 years, 11 months ago by raperez .
Hi @raperez for me, it’s difficult to understand what you are trying to do because I don’t know the code of your function. However, I suggest you try to add the parameter request=”remote” to the shortcode. I mean the shortcode will look like [content_no_cache id=”xxx” request=”remote”] Normally, CNC gets the content of the CNC element during an Ajax call directly from the database. Your $post variable may not work during the Ajax call. If you add the parameter request=”remote”, CNC will get the content via a remote HTTP request, and in that case, the same $post variable may work. The content will appear a little later on the page, but you may solve the issue. I hope it helps Have a great day Jose
Hello: I have created a shortcode to recover some data from a table. To search in this table, I must recover a value from the actual post (global $post) where the shortcode is located. Unfortunately, this variable is empty when called via no content cache. I have also tried request=”remote” parameter with no luck. When using the request=”remote” parameter my shortcode doesn’t work at all and I get an update error when trying to update the page where the shortcode is located. Any other thing that could be done? Thanks again for your fantastic help!! This reply was modified 2 years, 11 months ago by raperez .