Custom field not updating via functions upon publishing

There are two problems that I can see that cause your code to fail. The first is that you’re using update_page_meta, which does not exist. Use update_post_meta instead. The second is that you’re using the action save_page, which also does not exist. Use save_post, save_post is an action triggered whenever a post or page is … Read more

Set order acs and no paging for archive page

You can use pre_get_posts in your functions file for this with the WP_Query order and orderby parameters. function alter_query( $query ) { if ( $query->is_archive() && $query->is_main_query() && !is_admin()) { $query->set( ‘posts_per_page’, 100 ); } } add_action( ‘pre_get_posts’, ‘alter_query’ );

Pre-populating new Page creation with shortcodes

You can add any default content you like, but I don’t know of a way of doing it just for Pages (the following will apply to both Pages and Posts): add_filter( ‘default_content’, ‘my_default_post_content’ ); function my_default_post_content( $content ) { $content = “Hello World!”; return $content; } (place this in your functions.php file)

auto create only 1 wp page in activate custom plugin

register_activation_hook( __FILE__ , ‘my_plugin_install’); function my_plugin_install() { global $wpdb; $the_page_title=”Book”; $the_page_name=”book”; // the menu entry… delete_option(“my_plugin_page_title”); add_option(“my_plugin_page_title”, $the_page_title, ”, ‘yes’); // the slug… delete_option(“my_plugin_page_name”); add_option(“my_plugin_page_name”, $the_page_name, ”, ‘yes’); // the id… delete_option(“my_plugin_page_id”); add_option(“my_plugin_page_id”, ‘0’, ”, ‘yes’); $the_page = get_page_by_title( $the_page_title ); if ( ! $the_page ) { // Create post object $_p = array(); $_p[‘post_title’] … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)