WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Category Page] Page connections don't stay (3 posts)

  1. quietcity
    Member
    Posted 4 years ago #

    After installing plugin, I can activate and create connections between pages and categories. I see the updates on the front-end when I go to the post category. Some time later (I can't measure it - next day or several hours) the connections are lost. Returning to the "Category Pages" in the admin, all the connections are reverted to none.

  2. smurkas
    Member
    Posted 4 years ago #

    The whole thing resets when you do a quick edit.

    I added this to line 568:
    echo "<input type='hidden' name='p2c_active' value='1'/>";
    and then change the function that starts on line 584

    function page2cat_trigger_save($post_ID){
    	global $wpdb;
    	if ($_POST['p2c_active']):
    		$values = $_POST['p2c_bind'];
    		$via = "DELETE FROM {$wpdb->page2cat} WHERE page_ID = '".$_POST['post_ID']."'";
    		$result = $wpdb->get_results($via);
    		if(count($values) > 0):
    		foreach($values as $key=>$cat){
    			if($_POST['post_ID'] != ""):
    			$sql = "INSERT INTO {$wpdb->page2cat} (rel_ID, page_ID, cat_ID) VALUES ('','".$_POST['post_ID']."','".$cat."')";
    			$result = $wpdb->get_results($sql);
    			endif;
    		}
    		endif;
    	endif;
    }

    All I have added is the first if clause that checks for the new form field value that I added. Since this form element isn't present when doing a quick edit the function won't fire and delete all your connections.

    The function will fire normally when doing a real page edit and everything should work fine. I am running the latest wordpress version and everything has worked so far.

  3. Richard Coan
    Member
    Posted 3 years ago #

    Connections break in 3.0 on regular edits as well know.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags