Support

Account

Home Forums ACF PRO Can't Save Post if I Add a URL to a Text/URL Field??? Reply To: Can't Save Post if I Add a URL to a Text/URL Field???

  • So I tried submitting, waiting until it finished submitting, and then turned debug mode on. Here’s some of the errors I got:

    Notice: Undefined offset: 0 in /home/onestopmods/public_html/wp-content/themes/osmMK2/template-editpost.php on line 22
    
    Notice: Trying to get property of non-object in /home/onestopmods/public_html/wp-content/themes/osmMK2/template-editpost.php on line 22
    
    Notice: Undefined variable: specicat in /home/onestopmods/public_html/wp-content/themes/osmMK2/template-editpost.php on line 31

    and here’s the contents of my “editpost.php”:

    <?php 
    /*
    Template Name: Edit Post
    */
    acf_form_head();
    get_header();
    $postide = $_GET['id'];
    ?>
    
    <div id="main" class="full-width"><div class="wrap cf">
    
    	<div id="content" role="main">
    	
    		<?php while (have_posts()) : the_post(); ?>
    		<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
    			<h1 class="page-title">Editing Mod: <?php echo get_the_title("$postide"); ?></h1>
    
    			<div class="page-content rich-content">
    			<?php if ( current_user_can('edit_post', $postide) ) { ?>
    			<?php
    				$category = get_the_category("$postide"); 
    					$specat = $category[0]->cat_ID;
    						if($specat == 2){$namecat = Minecraft;}
    			?>
    			<?php 
    				if($specat == 2){$specicat = 1193;}
    			acf_form(array(
    				'post_id' => "$postide",
    				'post_title' => true,
    				'post_content' => true,
    				'field_groups' => array( 1185, 1191, $specicat, 1197, 1200),
    				'submit_value'	=> 'Submit Changes',
    				'return' => 'http://onestopmods.com/view-mods/',
    			)); 
    			?>
    			<?php } else { echo 'You do not have permission to access this page. If you are not logged in, try logging in. If you believe that this is an error, please <a href="http://onestopmods.com/contact/">Contact Us.</a>';} ?>
    			</div>
    		</div><!--end .hentry-->
    		<?php endwhile; ?>
    		
    	</div><!--end #content-->
    
    </div></div><!-- end #main -->
    
    <?php get_footer(); ?>

    It says the variables are undefined, but I’m getting them through a query string in the URL. Is this not possible to fix?

    I’d also like to note that these errors don’t show up when I initially load up the edit form. It only happens when I click submit and it redirects me to the same url, but with blank values everywhere. This error also doesn’t happen if there aren’t URLs (http://) in the fields.