engelen
  • Member for 8 years, 3 months
  • Last seen more than a week ago
How to Define Custom Number of Items in Comment Feed
1 votes

There's a filter for that! The filter comment_feed_limit can be used to adjust the LIMIT clause directly. By default, the option from Settings -> Reading is used ("Syndication feeds show the most ...

View answer
Shortcode won't execute
Accepted answer
1 votes

You're using your shortcode function to directly output something (using echo). Shortcodes are supposed to return the desired output rather than echo it directly. You could use output buffering to "...

View answer
Redirect users to a front end wp login page
1 votes

A good solution for this is to hook into login_init, which is fired before anything is outputted in wp-login.php. add_action( 'login_init', 'wpse149411_login_redirect' ); function ...

View answer
php include returns 1 as output with other outputs
Accepted answer
1 votes

First of all, this is not WordPress-specific, and does therefore not belong in WordPress.StackExchange. As it's so easy to answer, however... include is not a function, but it does return whatever ...

View answer
How to use current_post to open a new unordered list every five posts
Accepted answer
1 votes

You're basically checking ( $query->current_post + 1 ) % 5 == 0. For the last post, where $query->current_post equals 9, this also returns true, as 10 % 5 equals 0. Thus, another closing and ...

View answer
Redirect to Current Page after Login
Accepted answer
1 votes

wp_loginout accepts two arguments, $redirect (string) and $echo (boolean). You can specify the URL of the page to redirect to after logging in or out with the $redirect parameter. In your current code,...

View answer
Get the alphabetical sorted data with wpdb
1 votes

It isn't really WordPress-related indeed, but then again, OP doesn't seem to know that, so here's your answer :-). However, next time: this isn't WordPress-related, please post PHP-questions in the ...

View answer
Add a static page that links to homepage
1 votes

You can add "Custom" links to WordPress menus. There, just enter the URL to your website with the title you want.

View answer
wp_kses ignore allowed and allow everything
1 votes

wp_kses (Codex) removes unallowed tags, but it doesn't remove their content. So, if you have a "{something}", wp_kses only removes the tags, not the content, returning "{something}". Thus, this is ...

View answer
New checkbox in custom widget isn't saving data
1 votes

It seems the problem lies within redefining a widget: a widget with the ID "recent-posts" already exists, and that's causing some strange behaviour when saving the widget. This is possibly due the ...

View answer
apply_filters('the_content') - make it ignore shortcodes?
Accepted answer
1 votes

The function that parses the shortcode, do_shortcode is added as a filter on the_content by default, at priority 11. You can remove it using remove_filter: remove_filter( 'the_content', '...

View answer
Change default upload images size for contributors
Accepted answer
1 votes

The default image size for inserting images is stored in the options table in image_default_size. You can change the default image size by updating the option: update_option( 'image_default_size', '...

View answer
yoast seo plugin - remove bulk title and description editor menu from non-admins
Accepted answer
1 votes

Yoast SEO uses capabilities (WordPress docs on roles and capabilities) to determine whether users are allowed to bulk edit tiles and descriptions. The name of the capability used for this is ...

View answer
Mass/Bulk assign categories to posts
Accepted answer
1 votes

First, you would need to parse your text file. Using fopen and fgets you can read a file line-by-line. For every line, you separate the comma-separated list of IDs by using explode. After that, it's a ...

View answer
How to get all taxonomies which can be added in menu?
Accepted answer
0 votes

The taxonomies visible in the admin menu are exactly those taxonomies that were registered with show_in_menu = true and show_ui = true. For a reference on this, see the documentation on ...

View answer
Correct (and secure) way to escape url when using href attribute
Accepted answer
0 votes

The use of escaping data before outputting it to the browser ensures that no malicious (external) content (over which you have no control) can be outputted to the browser, and that no errors occur in ...

View answer
Creating widget - ask for selecting a post in the admin panel
0 votes

First off, try to work on your code formatting. As it is, it's rather unreadable and this makes it not only more difficult for us to understand how to help you, but also less scalable and suited for ...

View answer
List users of specific role instead of removing them with specific role
Accepted answer
0 votes

To fetch users from a specific role, you can use the role parameter of the get_users function. Each role has a specific ID; for WordPress' native roles, these are administrator, editor, author, ...

View answer
How to hook into the quick edit action?
0 votes

save_post is actually called on saving a post through the Quick Edit feature as well. As we find from the source code, the save_post action is called from two functions: wp_publish_post and ...

View answer
Annoying notification when trying to create a new page
Accepted answer
0 votes

This notification is added by your theme. You can remove the upsell notices for this theme by hooking into the ttfmake_is_plus filter: add_filter( 'ttfmake_is_plus', '__return_true' );

View answer
Sort order in get_posts
0 votes

The problem here is not that the posts that are being wrongly displayed are displayed under the wrong category, it's that they're not actually in the right category. For example, the post "Supporting ...

View answer
How to retrieve posts from parent category, splitting them per children when displayed?
0 votes

Calling WP_Query three times isn't too good for performance, as it will make three queries to the database. The way you're currently approaching this seems like the proper (and fastest) way in may ...

View answer
more tag in the $post->content when get_pages were used
Accepted answer
0 votes

You can use the WordPress function get_extended to fetch the different parts of a string (the part before and the part after the <!--more--> tag). get_extended returns an array with three keys, ...

View answer
widget exclude post by custom field
Accepted answer
0 votes

The meta_query parameter in WP_Query allows you to query posts that don't have a certain custom field. Furthermore, you can check for multiple custom fields. With two queries in meta_query, you can ...

View answer
How do I / Is it possible to execute an external PHP file / function inside Wordpress?
Accepted answer
0 votes

Using the domain name in the path won't work; you're not trying to specify a URL, but a path to a file, be it relative or not. Using include(ABSPATH . '../includes/header.php' ) should work. /...

View answer
Using wordpress translations strings in plugin
0 votes

Omitting the text domain from localization functions such as __ and _e will result in the default textdomain being used. The reason that your strings are not being translated is most likely to be that ...

View answer
How to use hook admin_init for add_action for custom post type column
0 votes

Hooking this into admin_init will ensure that the code only runs in the admin panel, but it's not the proper way to do so as it prevents other plugins from accessing the new column before that hook. ...

View answer
Fatal error in comments.php
0 votes

The error originates from the function _close_comments_for_old_posts, which accepts two arguments, $posts (array of WP_Post objects) and $query (WP_Query object). As you can see by the error being ...

View answer
Is it wrong to use the English version of WordPress to server a site in a different language?
Accepted answer
0 votes

There is no technical problem in doing so, and there won't be any complications or errors. However, it could be that not all content on the site will be in Indonesian. Some strings in themes and in ...

View answer
Mass/Bulk assign featured images to posts
Accepted answer
0 votes

As you don't have much programming experience, I'll post a ready-to-use solution here. I've looked at your code a little longer, and the problem is that after array_shift, $ids is still an array. ...

View answer