Tag Info

Hot answers tagged

2

You could hook into the publish_page transitional status action and use a simple SQL query (via $wpdb) to determine the highest current value of menu_order in the {prefix}_posts table and set the menu_order of the new page accordingly. Example code: add_action( 'publish_page', 'wpse155926_set_to_last_page', 10, 2 ); function wpse155926_set_to_last_page( ...


2

You could use ajax and the admin_footer-post-new.php hook. The sql would vary depending on whether you want the highest or most recently published order number. The following returns the highest published order number + 1: function wpse155926_set_menu_order() { $ret = array(); if ( check_ajax_referer( 'wpse155926_set_menu_order_post', 'nonce', ...


1

I'd highly recommend WP-CLI for such tasks. It is a tool that allows installation and configuration of WordPress on the command line. What you are trying could easily be done: wp core download wp core config --dbname=<dbname> --dbuser=<dbuser> --dbpass=<dbpass> wp core install --url=<url> --title=<site-title> ...


1

If you are using Linux, you are lucky enough, there is a command line tool EasyEngine which lets you install your complete site in 5 3 minutes, It was publicly released recently at Wordcamp Mumbai 2014. Not just installation, but also provides you other options to manage sites. I'd say a really handy tool.


1

Does wordpress allow me to add a php file to the root directory to execute custom scripts? WordPress can't prevent you from adding PHP files to the root directory, but there is no builtin functionality to load those files. You can load them yourself but if you are not careful they will load outside of WordPress context, which is a painful way to work. ...


1

I can't think of any valid reason why you'd want to do what you're proposing to do. Wordpress has many hooks that you can use to run code at virtually any stage. For example add_action('init','some_function'); some_function() { do_stuff here } Would essentially run everytime wordpress is called (Ie:, page loaded) allowing you to do whatever you want. ...



Only top voted, non community-wiki answers of a minimum length are eligible