Title: Empty post problem
Last modified: June 29, 2020

---

# Empty post problem

 *  [azrieil](https://wordpress.org/support/users/azrieil/)
 * (@azrieil)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/empty-post-problem/)
 * Some template, contains social shortcode which I getting with ajax return empty
   string.
    The problem is in this part shortcode.php:27
 *     ```
       global $post;
       if(!is_object($post) ) {
         return;
       }
       ```
   
 * But from code below we can see that post it not required in some cases
 * shortcode.php:32
 *     ```
       if ($customUrl) {
       	$targetUrl = $customUrl;
       	$postId = 0;
       } elseif ($url) {
       	$targetUrl = $url;
       	$postId = 0;
       } elseif (is_front_page()) {
       	$targetUrl = esc_url(home_url());
       	$postId = 0;
       } elseif (!is_singular() && $type == 'vertical') {
       	$targetUrl = html_entity_decode(esc_url(the_champ_get_http() . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]));
       	$postId = 0;
       } elseif (isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING']) {
       	$targetUrl = html_entity_decode(esc_url(the_champ_get_http() . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]));
       	$postId = $post->ID;
       } elseif (get_permalink($post->ID)) {
       	$targetUrl = get_permalink($post->ID);
       	$postId = $post->ID;
       } else {
       	$targetUrl = html_entity_decode(esc_url(the_champ_get_http() . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]));
       	$postId = 0;
       }
       ```
   
 * But even if I specify post url, empty post object( coz it ajax ) not allow me
   to use this shortocde.
 * Can you provide a fix? Like
 *     ```
       ...
       } elseif (isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING'] && is_object($post)) {
       ...
       } elseif (get_permalink($post->ID) && is_object($post)) {
       ...
       ```
   
    -  This topic was modified 5 years, 10 months ago by [azrieil](https://wordpress.org/support/users/azrieil/).

Viewing 1 replies (of 1 total)

 *  Plugin Author [Heateor Support](https://wordpress.org/support/users/heateor/)
 * (@heateor)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/empty-post-problem/#post-13052992)
 * We will take care of it in upcoming updates.

Viewing 1 replies (of 1 total)

The topic ‘Empty post problem’ is closed to new replies.

 * ![](https://ps.w.org/super-socializer/assets/icon-128x128.png?rev=1866723)
 * [Social Share, Social Login and Social Comments Plugin - Super Socializer](https://wordpress.org/plugins/super-socializer/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/super-socializer/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/super-socializer/)
 * [Active Topics](https://wordpress.org/support/plugin/super-socializer/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/super-socializer/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/super-socializer/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Heateor Support](https://wordpress.org/support/users/heateor/)
 * Last activity: [5 years, 10 months ago](https://wordpress.org/support/topic/empty-post-problem/#post-13052992)
 * Status: not resolved