How can I assign post a specific ID on creation?

Yes, use the “import_id” field in the post, when calling wp_insert_post. This is treated as a “suggested” ID for the post that will be used if no post with that ID already exists. $post = array( ‘post_title’=>’whatever’, ‘post_content’=>’whatever’, ‘import_id’=>123 ); wp_insert_post($post);

brute force attack even though it is limited by IP

WordPress is also an XML-RPC server. So I guess these bots tried to gain access through the XML-RPC protocol via the xmlrpc.php file in your WordPress root directory. It’s possible to login and most likely your security plugin is picking up failed login attempts when wp_authenticate() is called and the wp_login_failed hook is activated. Here’s … Read more

Hacking TinyMCE for better usability (shortcodes and html)

Have a look at my Gridster Plugin, it replaces every shortcode [gridster id=”” title=””] with a visual replacement, like you know from the -Shortcode. To change parameters of the current shortcode, you’re able to click a button and a tinyMCE modal will let you change anything within a user-friendly GUI. The functions are based on … Read more

Explanation of this hacked code

There are 3 main ‘functions’ of this code. The two lines check that pingnow and pass are defined and that pass is the correct value. pingnow is used later to switch between ‘functions’. The first is run if the pingnow GET variable is login. It logs in the requesting user as the ‘admin’ user. This … Read more

Posts in multiple Categories different single.php

Instead of making it category specific you could use post formats and use different content-templates. In single.php you can write <?php get_template_part( ‘content’, get_post_format() ); ?> Then create different post formats add_theme_support( ‘post-formats’, array( ‘withpictures’, ‘withcomments’ ) ); Then create different post templates content-withpictures.php, content-withcomments.php When creating content the chosen post format will determine the … Read more

How to generate/update a XML sitemap without plugins?

The following code works right off the bat. Your sitemap will show up on: https://your-website-name.com/sitemap.xml Every time you create or update a page, post or custom post type it will show. Make sure to add the name of your custom post type: add_action( ‘publish_post’, ‘ow_create_sitemap’ ); add_action( ‘publish_page’, ‘ow_create_sitemap’ ); add_action( ‘save_post’, ‘ow_create_sitemap’ ); function … Read more

How would I compare and remove hacks to core?

Pull down the copy of WordPress from your client’s server to your local. Download a clean zip of the version of WordPress your client has installed. http://wordpress.org/download/release-archive/ From there, you will need to use a file comparison tool (i.e. Diff on Linux). You can also use GIT to find the difference in folders by creating … Read more

How to get permalinks with category base working with sub-categories

I was able to get this to work pretty easily actually. I am now able to have my category base in my permalinks. This allows me to now have URLs like: http://www.new1450.dev/industries/ {Main blog post only showing category selection} http://www.new1450.dev/industries/development/ {a parent category} http://www.new1450.dev/industries/development/parent-category-i/ {child of parent} http://www.new1450.dev/industries/development/parent-category-i/child-category-i/ {child of child} http://www.new1450.dev/industries/development/parent-category-i/child-category-i/some-cool-post/ {actual post} This … Read more

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