WordPress text field in array problem

It looks like you may be creating an array around a single long string that needs to be split up into array elements (assuming $idsposts is a string and not an array). Try using $myposts = explode(“,”, $idsposts); Instead of just adding $idsposts as the only element of your $myposts array. You can also check … Read more

count_posts to a standalone link

You can use wp_count_posts Example using code above: $count_posts = wp_count_posts(‘post’); if ( $count_posts ) { $published_posts = $count_posts->publish; } <a href=”https://wordpress.stackexchange.com/questions/250800/YOUR_LINK”>YOUR TEXT <?php echo $published_posts; ?></a>

Permalink base only for posts

To get your desired structure: Go to Settings > Permalinks in Admin. Under Common Settings, click Custom Structure and enter /blog/%postname%/ Click Save Changes button. This sets the permalink structure for posts. Pages already appear at at the root of your install, so no modification is needed for that.

Allow author to duplicate but not edit post

Duplicating a post is a 3-step process: Create a new post using data from the source post. Copy the source post’s metadata over to the new post. Copy the source post’s terms over to the new post. Since you’re only reading from the source post, duplicating is not more of editing, as you suggest. Here … Read more

how to redirect page after delete post inside a post page?

There is a action hook in wp_delete_post() called after_delete_post. So hook a function in that hook and redirect your user to where ever you want. You can redirect to author’s page by below code- add_action( ‘trash_post’, ‘the_dramatist_redirect_after_post_delete’ ); function the_dramatist_redirect_after_post_delete() { if ( !is_admin() ) { wp_safe_redirect( get_author_posts_url( get_current_user_id() ) ); exit(); } } Hope … Read more

How to retrieve post statuses of available posts?

If you want the post types that have posts, why not get all post types and get a count for each of them (not tested): $post_types = get_post_types(); foreach ( $post_types as $post_type ) { $count = wp_count_posts( $post_type ); if( $count > 0 ) { // do something with it } }

How to add content to the menu

Use Appearance, Menus in the Admin area to add menu items; create a menu first if not already there. Then assign the menu to the site via the Manage Locations tab on the same screen. Depending on the theme you use, you’ll be able to assign your menu so it appears where allowed by the … Read more

Posts are not showing up on next page.

For one thing, that plugin hasn’t been updated in 8 years (https://wordpress.org/plugins-wp/wp-page-numbers/). George W. Bush was still president when that code was written. You should never use plugins that are not actively maintained because they most likely won’t work. Try wp_page-navi (https://wordpress.org/plugins/wp-pagenavi/). It’s actively developed/maintained.

How do I set content in my pages so that it remains permanent while blog posts are added below?

If you want to show that static content in your post then you can find post.php template in your theme and find function “the_content();” just before this function make a div for your static content and add our static content there. Similarly if you want to show that content in page then find page.php template … Read more