Forum Replies Created

Viewing 15 replies - 256 through 270 (of 8,045 total)
  • Plugin Author Daniel Iser

    (@danieliser)

    @sumukha – To be clear, we have lots of block level controls, but our elementor integration consists our global restrictions working on pages & content built with Elementor. Those same things should hopefully work for other page builders and includes filtering posts that are restricted from appearing in loops for example.

    We don’t offer conditional controls on Elementor modules at this time though, maybe in the future. Is that what your after for Divi as well?

    Plugin Author Daniel Iser

    (@danieliser)

    @ercanakcay – Sorry to hear that. In general this came up quite a few times when v2 went out, most turned out to be caused by 3rd party plugins or themes for various reasons. Usually due to filtering queries or blocking rest API access or throwing random PHP errors.

    If the post types show up, but the results aren’t shown its likely best to start with the steps here to track it down: https://ww.wp.xz.cn/support/topic/php-warnings-169/#post-17074537

    That said install a Twenty-* default theme such as Twenty-Twenty-Three before troubleshooting, it will be used to let you test that the theme isn’t the issue as well.

    Check the browser console for JS errors or network request errors as well.

    Let us know what you find.

    PS. If you find out which plugin is causing the issue, you can use troubleshooting mode or even just deactivate that plugin while you save your Content Control settings, then put it back like it was before. This lets you manage settings, but after that it doesn’t matter.

    • This reply was modified 2 years, 6 months ago by Daniel Iser.
    Plugin Author Daniel Iser

    (@danieliser)

    You would end up needing to recreate the functionality for managing those blocks of warranty terms, but I think the new Block Patterns (saved block templates) could be the trick.

    Can the short description be editing using the block editor (drag and drop like blog posts), or is it a simple text editor?

    Plugin Author Daniel Iser

    (@danieliser)

    So a couple of things:

    1. Are those blocks something you already have available (warranty terms).
    2. Is that short description editable using the block editor?

    If yes to both of those, our Pro version does allow applying boolean rules to your blocks. Those rules do include rules based on the taxonomies of the current item being viewed.

    So if I understand correctly, and that description is block editor friendly,

    1. When pro launches next week, install that.
    2. Insert the block for warranty terms into the description.
    3. Enable Block Rules in the sidebar and “Conditional Rules” under that.
    4. Add a rule set and a rule for Is Product with Product Category X or whatever rule you need. You can use groups as well as choose AND / OR for comparing rules for complex scenarios.

    You can test it out for yourself in a demo site based on the last beta: https://app.instawp.io/launch?t=content-control-pro-demo—star-wars-theme&d=v2

    Plugin Author Daniel Iser

    (@danieliser)

    @peter8nss – Patched for v2.1 which goes out sometime in the next week or so before Pro officially launches.

    Plugin Author Daniel Iser

    (@danieliser)

    @karbou – Hmm that code already checks post is set correctly.

    The global $post var itself should never be an int, always the WP_Post object, all global functions like get_the_ID() rely on this so checking if its already an ID seems inappropriate.

    This is get_the_ID() for reference:

    return ! empty( $post ) ? $post->ID : false;

    But for the sake of testing, I set up a restriction on posts and set them to show a custom message if restricted.

    I then made these 6 shortcodes and inserted them all onto pages, I also installed Query Monitor to check for errors during page rendering.

    I was not able to produce the error or warning you mentioned. Maybe you can work out an example shortcode that reproduces it reliably.

    It should be noted that only the ones using the global $post overrides, and using the_content() or apply_filters('the_content', get_the_content( applied restrictions to content.



    Even with all these running on a single page, the function on the line you pointed to only gets called twice, neither time was $post improperly set, even when I set it to an ID (in the last 3) this error doesn’t come up.

    My guess is you have another plugin also interacting with the global $post in some way that makes this occur only for you. If you can narrow it down using the Health Check & Troubleshooting plugin’s Troubleshooting mode that might help: https://ww.wp.xz.cn/support/topic/php-warnings-169/#post-17074537

    Let me know.

    
    add_shortcode('ca_test_shortcode', function () {
        // Fetch some posts to test with. Adjust the query as needed.
        $args = array(
            'posts_per_page' => 5, // Change this number to adjust the number of posts
    		'post_type' => 'post',
        );
    
        $my_posts = get_posts($args);
    
        // Start buffering output
        ob_start();
    
    	global $post;
    
    	$old_post = $post;
    
    	echo '<h4>setup_postdata( $post ) - global $post overload</h4>';
    
    	echo "<ul>";
    
        // Loop through the posts and apply the user's setup
        foreach ( $my_posts as $post ) {
            setup_postdata( $post );
            // You can include a template part or any other content here
    		echo '<li>- ' . get_the_title() . '<br/>';
    		the_content();
    		echo '</li>'; // Example: Display the title
    	}
    
        // Reset postdata to ensure global $post returns to its original state
        wp_reset_postdata();
    
    	echo "</ul>";
    
    	$post = $old_post;
    
        // Get the buffered content
        $output = ob_get_clean();
    
        return $output;
    } );
    
    add_shortcode('ca_test_shortcode2', function () {
        // Fetch some posts to test with. Adjust the query as needed.
        $args = array(
            'posts_per_page' => 5, // Change this number to adjust the number of posts
    		'post_type' => 'post',
        );
    
        $my_posts = get_posts($args);
    
        // Start buffering output
        ob_start();
    
    	echo '<h4>setup_postdata( $post ) - only</h4>';
    
    	echo "<ul>";
        // Loop through the posts and apply the user's setup
        foreach ( $my_posts as $post ) {
            setup_postdata( $post );
            // You can include a template part or any other content here
    		echo '<li>- ' . get_the_title() . '<br/>';
    		the_content();
    		echo '</li>'; // Example: Display the title
    	}
    	echo "</ul>";
    
        // Reset postdata to ensure global $post returns to its original state
        wp_reset_postdata();
    
        // Get the buffered content
        $output = ob_get_clean();
    
        return $output;
    });
    
    add_shortcode('ca_test_shortcode3', function () {
        // Fetch some posts to test with. Adjust the query as needed.
        $args = array(
            'posts_per_page' => 5, // Change this number to adjust the number of posts
    		'post_type' => 'post',
        );
    
        $my_posts = get_posts($args);
    
        // Start buffering output
        ob_start();
    
    	echo '<h4>setup_postdata( $post ) - pass $post to get_the_title</h4>';
    
    	echo "<ul>";
        // Loop through the posts and apply the user's setup
        foreach ( $my_posts as $post ) {
            setup_postdata( $post );
            // You can include a template part or any other content here
    		echo '<li>- ' . get_the_title( $post ) . '<br/>';
    		echo apply_filters( 'the_content', get_the_content( null, null, $post ) );
    		echo '</li>'; // Example: Display the title
    	}
    	echo "</ul>";
    
        // Reset postdata to ensure global $post returns to its original state
        wp_reset_postdata();
    
        // Get the buffered content
        $output = ob_get_clean();
    
        return $output;
    });
    
    
    add_shortcode('ca_test_shortcode4', function () {
        // Fetch some posts to test with. Adjust the query as needed.
        $args = array(
            'posts_per_page' => 5, // Change this number to adjust the number of posts
    		'post_type' => 'post',
    		'field' => 'ids',
        );
    
        $my_posts = get_posts($args);
    
        // Start buffering output
        ob_start();
    
    	echo '<h4>setup_postdata( $id ) - only</h4>';
    
    	echo "<ul>";
        // Loop through the posts and apply the user's setup
        foreach ( $my_posts as $post ) {
            setup_postdata( $post );
            // You can include a template part or any other content here
    		echo '<li>- ' . get_the_title() . '<br/>';
    		the_content();
    		echo '</li>'; // Example: Display the title
    	}
    	echo "</ul>";
    
        // Reset postdata to ensure global $post returns to its original state
        wp_reset_postdata();
    
        // Get the buffered content
        $output = ob_get_clean();
    
        return $output;
    });
    
    add_shortcode('ca_test_shortcode5', function () {
        // Fetch some posts to test with. Adjust the query as needed.
        $args = array(
            'posts_per_page' => 5, // Change this number to adjust the number of posts
    		'post_type' => 'post',
    		'field' => 'ids',
        );
    
        $my_posts = get_posts($args);
    
        // Start buffering output
        ob_start();
    
    	echo '<h4>setup_postdata( $id ) - pass $id to get_the_title</h4>';
    
    	echo "<ul>";
        // Loop through the posts and apply the user's setup
        foreach ( $my_posts as $post ) {
            setup_postdata( $post );
            // You can include a template part or any other content here
    		echo '<li>- ' . get_the_title( $post ) . '<br/>';
    		echo apply_filters( 'the_content', get_the_content( null, null, $post ) );
    		echo '</li>'; // Example: Display the title
    	}
    	echo "</ul>";
    
        // Reset postdata to ensure global $post returns to its original state
        wp_reset_postdata();
    
        // Get the buffered content
        $output = ob_get_clean();
    
        return $output;
    });
    
    add_shortcode('ca_test_shortcode6', function () {
        // Fetch some posts to test with. Adjust the query as needed.
        $args = array(
            'posts_per_page' => 5, // Change this number to adjust the number of posts
    		'post_type' => 'post',
    		'field' => 'ids',
        );
    
        $my_posts = get_posts($args);
    
        // Start buffering output
        ob_start();
    
    	global $post;
    
    	$old_post = $post;
    
    	echo '<h4>setup_postdata( $id ) - only</h4>';
    
    	echo "<ul>";
        // Loop through the posts and apply the user's setup
        foreach ( $my_posts as $post ) {
            setup_postdata( $post );
            // You can include a template part or any other content here
    		echo '<li>- ' . get_the_title() . '<br/>';
    		the_content();
    		echo '</li>'; // Example: Display the title
      }
    	echo "</ul>";
    
        // Reset postdata to ensure global $post returns to its original state
        wp_reset_postdata();
    
    	$post = $old_post;
    
        // Get the buffered content
        $output = ob_get_clean();
    
        return $output;
    });
    
    Plugin Author Daniel Iser

    (@danieliser)

    @baroquer – I’m not quite sure I understand the question. That plugin seems to be used to insert content dynamically. You can use our Block Rules in the block editor to show/hide blocks based on rules. Our Pro version adds ecommerce rules for blocks as well.

    So I guess if you can insert a block in the page where you are talking about, our Pro version could help you show/hide it appropriately, but we don’t have anything that lets you choose to insert content X on page Y at location Z.

    Hope that helps.

    Plugin Author Daniel Iser

    (@danieliser)

    @rabbitwordpress – Sorry to hear that. We had some issues early on but if you just updated to the latest, its been pretty stable. Can you tell me what happens when you upgrade?

    • Do you see the notice to “Process Updates”?
    • Do the updates succeed?
    • Do your restriction settings look correct in the new interface?
    • What are your restriction settings?
    • What exactly happens with your content on the front end?
    • What did it do before the update?
    Plugin Author Daniel Iser

    (@danieliser)

    @karbou – Curious. Are you calling wp_reset_postdata(); after your loop to properly reset the global postdata when your done?

    I don’t see that in your code but should occur after the foreach ends.

    That aside are you calling for the_content or excerpt in the template?

    Can you provide a more complete example to replicate the issue and work out how to resolve it properly, including the minimal amount of template and loop code needed to throw an error.

    Plugin Author Daniel Iser

    (@danieliser)

    @peter8nss – Great catch, I know exactly what is happening and how to address it.

    We scan every load of the block editor for unknown block types and save them via the Rest API.

    There is no built in method to get a full list of all block types since they can be registered various ways, including in JS after the editor is loaded conditionally based on post type etc.

    Our method scrapes them after they are registered and is the only reliable way to get that list, but it shouldn’t throw errors, should probably just not make the request in the first place.

    Thinking ahead I might look to make that scan something you turn on for 60 seconds or something explicit so that its not always running.

    Plugin Author Daniel Iser

    (@danieliser)

    @tomibaum – Awesome glad you worked it out.

    Please take a moment to rate & review the plugin and or support to spread the word.

    Plugin Author Daniel Iser

    (@danieliser)

    @tomibaum – Sorry, I haven’t seen/heard of any similar issues. In general practice, that likely isn’t possible, at least not as described. Specifically our plugin doesn’t do anything browser side, only on the server prior to sending content to the browser.

    As such there is almost no way a browser specific issue should come up related to global restrictions being applied on the user side.

    Without a more in depth description of what the user is facing its hard to say what might be going on but the first things that come to mind are:

    1. Cached redirect – In general it shouldn’t occur, but if he tried to go to a page and was redirected, if the redirect was modified or extra headers were sent for the redirect instructing the browser to cache it, it might redirect from that page even after logging in. Our plugin doesn’t offer or do this, but we call WP functions that do allow it while redirecting.
    2. Your using a caching plugin or service that is possible overly optimized and not bypassing caches when logged in every time.
    3. His browser cookies are corrupted, and the WP login cookie simply isn’t getting set properly.

    Maybe try having him:

    1. Go directly to the login page first (/wp-login.php if it hasn’t been blocked).
    2. Clear his cookies and browser saved data for the site.
    3. Has he tried an incognito tab? (verify its not cookie/browser cache related)
    4. Tried a different internet connection/pc etc? (ensure its not something with his user account)

    Hope that helps, but honestly I’m gonna defer to my original statement, very unlikely our plugin is related to the issue directly, even less so since you tested on Edge without issue yourself. More likely an issue specifically for this person, either user account, caching/cookies, browser config, his own internet/firewall/proxy etc.

    • This reply was modified 2 years, 7 months ago by Daniel Iser.
    Plugin Author Daniel Iser

    (@danieliser)

    @forefront – Sorry to hear that. Can you email our support and ask directly for me. I’ll definitely dig into this and see why things broke down. That doesn’t sound acceptable at all.

    Plugin Author Daniel Iser

    (@danieliser)

    @lexi777 – Sorry to hear that, and that I didn’t see this sooner, don’t usually respond to 5 star reviews.

    In general all of the things you described are either customizable via the popup theme editor (close button size, position, color etc).

    If the button isn’t visible either you have chosen Fixed positjon & Center position, and your popup is too large for the screen. you could set the position to top-center to resolve that, but also fixed should only be used in certain scenarios.

    The last possibility is you might have other errors on your site breaking our plugins functionality. Our plugin depends on Javascript without errors, so any JS errors on your site from themes or other plugins could be contributing.

    Hope that helps. Message our support if your still having issues.

    Plugin Author Daniel Iser

    (@danieliser)

    @volcaidon – Sorry to hear that, but it is highly unlikely our plugin is the main cause. It may be part of the issue, but a more likely cause is that your menus simply have a ton of items in them or a lot of plugins that added custom fields for menu items.

    Unfortunately this is a known issue with WP core itself. The way it saves menus is all at once. Servers have a max amount of info you can submit at once, and a large menu with lots of extra field data can easily go over that limit.

    Large menus generally have lots of side effects as well like loading slow in the editor.

    That said I highly recommend you either prune your menus down to more manageable sizes or consider if there are other plugins that are also adding extra fields to menu items that aren’t needed.

    Generally speaking our plugin isn’t the only one that adds stuff to the menu editor, so it could simply also be that another plugin, theme or multiple have fields there too, and ours simply pushed you over the limits of your host/server.

    Happy to debug with you but this plugin won’t crash a site or make menus load slow on its own, only with compounded issues from other sources could it have such an effect, but obviously in those cases its not really the problem, just part of a larger issue.

    • This reply was modified 2 years, 7 months ago by Daniel Iser.
Viewing 15 replies - 256 through 270 (of 8,045 total)