wordpress admin part is not accesbile after server shifting

There are following possibilities when you cann’t open wp-admin 1.There should be some file missing 2.Some function deny to login in themes files 3.Some plugin may also create issue Solution:- 1.Replace all files from new WordPress except wp-content and wp-config file 1. Rename your theme folder in wp-content 2. Rename Plugins folder in wp-content Hope … Read more

WordPress Staging and Testing of Plugins Best Practices

I don’t think there is the one correct answer. We use Git to manage versions. We have the master branch, that syncs with an online staging server, that has it’s own database. (Using the live database is kinda too hot for my taste.) Then there is the stable branch, that syncs with the live server. … Read more

How to get the slug of the homepage when editing it in WP admin?

post_name would be the slug as it was set before the page became the front page. When the URL for the front page is output via the API, the get_page_link function checks if the ID matches the page_on_front option and returns the home_url in that case. This is why you should always use the API … Read more

Dynamically display font icons in widget

This is more a PHP question from what I can gather, but hopefully this will help or at least get you on your way. I am making a few assumptions here, like you already have FontAwesome called and working in your site for example. I am also not sure why you have 2x get_post_meta(); functions … Read more

Dynamically replicate custom metabox in custom post type

please try this code. this code will create meta boxes dynamically <?php add_action( ‘add_meta_boxes’, ‘dynamic_add_custom_box’ ); /* Adds a box to the main column on the Post and Page edit screens */ function dynamic_add_custom_box() { add_meta_box( ‘dynamic_sectionid’, __( ‘Shortcode Information’, ‘myplugin_textdomain’ ), ‘dynamic_inner_custom_box’, ‘post’);} Please add slug name of Custom post in above function in … Read more

WordPress pagination not working in search result page

okay sorry for mentioning only link as an answer.. if first pagination link shows 404 error that should be a permalink issue. but to u its second page so definitely it because of some code mistake. please check this code. /*Loop Pagination – A WordPress script for creating paginated links on archive-type pages.*/ function loop_pagination( … Read more

Populate custom field on publish or update

Are you using advanced custom fields, correct? Not sure if ACF will pick up the fields without the $post_id set as the second parameter for get_field, so i changed your code to include the post id. function update_booklink_field( $post_id ) { if ( ‘book’ == $_POST[‘post_type’] ) { $genre = get_field(‘genre’,$post_id); $bookname=get_field(‘book name’,$post_id); $author=get_field(‘author’,$post_id); $booklink=”http://mybooks/”.$genre.”https://wordpress.stackexchange.com/”.$author.”https://wordpress.stackexchange.com/”.$bookname.”.com”; … Read more

mySQL queries are executed twice on wordpress website

The use of wpdb->insert and wp_insert_post both accomplish an SQL Insert, which is why you’re seeing 2 records each time. You must use only one instance of an insert method, and then Pass $my_post to WP_Query CLARIFICATION As Milo points out in his comment wpdb->insert will insert into any table, while wp_insert_post is used to … Read more