I belive you need to declare a record:
declare
del_rec record;
begin
for del_rec in select item_id from cr_items
where content_type = ''cr_wp_attachment''
loop
update acs_objects set context_id = null where context_id
=del_rec.item_id;
PERFORM content_item__delete(del_rec.item_id);
end loop;
return 0;
end;