class Shellpress::Post
Constants
- ORDER
Public Instance Methods
delete(id)
click to toggle source
# File lib/shellpress/post.rb, line 10 def delete(id) force = options[:force] type = options[:type] php = "<?php include 'wp-load.php';" if id =~ /\d+/ php << "wp_delete_post(#{id}, #{force});" else php << "$post = get_page_by_path('#{id}', OBJECT, '#{type}');" php << "if ($post) wp_delete_post($post->ID, #{force});" end php << "?>" File.open("temp.php", "w") {|f| f.write(php)} run "php -q temp.php" remove_file "temp.php", :verbose => false end